I recently created a new language called ;# (pronounced "Semicolon Hash") which only has two commands:

; add one to the accumulator

# modulo the accumulator by 127, convert to ASCII character and output without a newline. After this, reset the accumulator to 0. Yes, 127 is correct.

Any other character is ignored. It has no effect on the accumulator and should do nothing.

Your task is to create an interpreter for this powerful language!

It should be either a full program or a function that will take a ;# program as input and produce the correct output.


Output: Hello, World!
Program: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#

Output: ;#
Program: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#

Output: 2 d����{���
Program: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;hafh;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;f;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;###ffh#h#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ffea;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#au###h;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;h;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;o

Output: Fizz Buzz output
Program: link below

Output: !
Program: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#

Fizz Buzz up to 100

  • 1
    \$\begingroup\$ Is it acceptable if an interpreter doesn't terminate its execution at the end of the input but instead keeps looping indefinitely without producing extra output? \$\endgroup\$
    – Leo
    Commented May 22, 2017 at 9:26
  • 6
    \$\begingroup\$ The second example makes me wonder about a program to encode a program to produce an output... recursive compilation! \$\endgroup\$
    – frarugi87
    Commented May 22, 2017 at 9:29
  • 1
    \$\begingroup\$ @iamnotmaynard Semicolon Hash \$\endgroup\$ Commented May 23, 2017 at 15:09
  • 5
    \$\begingroup\$ Maybe Wink Hash would be easier to say \$\endgroup\$ Commented May 23, 2017 at 17:42
  • 1
    \$\begingroup\$ The Pastebin link appears to be dead. \$\endgroup\$
    – EasyasPi
    Commented May 22, 2021 at 4:29

141 Answers 141


Gol><>, 20 18 bytes

Credit to Jo King.


Try it online!

How it works

                    Accumulator (m) is stored at the bottom
iE;                 Take input (n) as char; halt if EOF
   :`#=q            If n == '#'... (preserving n on the top)
        $o            Output m as char, discarding it
          `;=+      If n == ';', increment m
              `~P%  m = m % 127
                    Repeat indefinitely

Previous submission, 20 bytes


Try it online!

How it works


                      Accumulator (m) is always stored at the bottom
iE;                   Take input (n) as char, halt if EOF
   :`#=Q      |       If n == '#'... (preserving n on the top)
        $`~P%o        Swap m to the top, output m%127 as char
               `;=?   If n == ';'... (discarding n; m is exposed to the top)
                   P  Increment m
                      Repeat indefinitely
  • \$\begingroup\$ 18 bytes \$\endgroup\$
    – Jo King
    Commented Sep 6, 2018 at 13:07

Backhand, 37 bytes

}>_oi!{:0v] @! |{^:v-"%";"#""-"|{]~.

Try it online!

As usual with Backhand programs, I'm pretty sure this could be golfed further, but to do so would require some restructuring.


Note that by default the pointer moves three steps at a time

}>                 Start on the second character
    i  :  ]  ! |{  Get input and check if it is EOF
            @      Reflect and terminate if so
                  :  "  ;  "  - |{     Check if the character is a ;
                                   ~.  If so, pop the extra copy of the character
                      %  "    "  [    Increment by 1 and modulo by 127
                 ^ v    Decrement the pointer step value by one and then increment it again to skip the |{
 >_  !  0  And restart the loop
                                |      If it is not a ;, reflect
                    -  "  #  "         Check if it is a #
         v   !   ^   Increment pointer and decrement again
}>_o  !{    Output if the character was a # and restart the loop

C# (Visual C# Interactive Compiler), 66 bytes


Try it online!


PHP, 84 79 70 1 + 63 = 64 bytes

for(;$c=$argn[$i++];$a+=$c==";")$c^A^R||$a=~-print chr($a%127);

Run as pipe with -nR

Try it online!


CJam, 18 bytes


Try it online!


q                  "Take the whole input as a single string";
 '#/               "Split the input string with hashes";
                   "This counts the empty results";
                   "According to the challenge empty results can only be";
                   "generated from trailing #'s";
    {         }%   "Map every ; sequence in the string:";
     ';e=          "Count the semicolons"
         127%      "Find the remainder of the length w/ 127";
             c     "Convert to a character"
                ); "There is a trailing null string designed for this check";
                   "If there isn't a trailing null string (i.e.)";
                   "program doesn't end with #, this removes the last item of the list";
                   "Implicit flatten the list & print as string";

Packed Pyth, 14 bytes

Hex dump: AD 43 1F 7B 88 F8 43 4A BE 75 C7 6C 59 37

Try it online!

Pyth, 16 bytes


Try it online!

Python equivalent:

for N in input().split('#')[:-1]:
    print(end=chr(N.count(';') % 127))

Token by token explanation:

V                 # for N in                        :
   w              #          input()                      # take one line of input
  c \#            #                 .split('#')
 P                #                            [:-1]      # discard last element
          N       #                N
         / \;     #                 .count(';')
        %    127  #                             % 127
       C          #            chr(                  )
      p           #  print(end=                       )   # print without trailing newline

After doing this, I looked at the other Pyth answers and found that KarlKastor's also got 16 bytes. However, I believe my answer is more correct, as it does not print a trailing newline. Since every ;;;;;;;;;;# in the input results in outputting a newline, an extra one should not be added at the end.

Funnily enough, we also both made an imperative version. Mine comes in at 25 bytes:


Try it online!

Python equivalent:

for N in input():
    if N==';': Z = (Z % 127) + 1
    if N=='#': print(end=chr(Z)); Z=0

Burlesque, 19 bytes


Try it online!

'#;;     # Split strings at #s
 ';CN    # Count the number of ; in each
  127.%  # Mod 127
  L[     # Convert to char
}\m      # Map and concatenate

JavaScript (Node.js), 86 bytes


Try it online!

  • \$\begingroup\$ This is not applying the modulo by 127. \$\endgroup\$
    – Deadcode
    Commented Jan 23, 2020 at 9:26

Prolog (SWI), 104 bytes

It worked out to be shorter to write directly to stdout inside the predicate. The more idiomatic way of implementing something like this in Prolog would be to have third parameter for the predicate which would be the output from interpreting the program.

A+[E|T]:-E=35,!,C is A mod 127,put_code(C),0+T;E=59,!,B is A+1,B+T;A+T.

Try it online!

  • \$\begingroup\$ You can remove the mod by matching against 127+X (my prolog terminology might be off) \$\endgroup\$
    – user41805
    Commented Jan 24, 2020 at 17:20

PHP, 56 75 bytes

foreach(explode('#',$argn,-1)as$c)echo chr((count_chars($c,1)[59]??0)%127);

Try it online!

Thanks to @Umbrella for the nudge. Actually read the question and bug fixed.

  • \$\begingroup\$ This will echo a non-printable character at the end. Pass -1 to explode to fix. \$\endgroup\$
    – Umbrella
    Commented Jan 24, 2020 at 21:45

Ral, 136 bytes


Try it online!

Somewhat clarified

Code                         Stack after       Description
,:1-11:+:+:+:++:+:+:+?       n                 Input a character (n) and jump to the end if zero
:11:+:+:+:+-:+:+1-+:0?       n, n-59           Jump to the start if n>59
10*+0=                       n, n-59           Add 1 to the accumulator
1+0?                         n                 Jump to the start if n>58
10*-0=                       n                 Remove 1 from the accumulator
111:+:+:+:++:++-:0?          35-n              Jump to the start if n<35
0-0?                                           Jump to the start if n>35
0*                           acc               Load the accumulator from memory
:1:+:+:+:+:+:+:+1-+          acc, acc-127          Remove 127 from the accumulator
:1+1111:+:++:+:++:+:++?      acc, acc-127          Continue the loop (with acc=acc-127) if acc≥127
1=.                                            Print the accumulator
00=                                            Clear the accumulator
10?                                            Jump to the start

R, 79 76 bytes

Edit: -3 bytes thanks to Giuseppe


Try it online!

First deletes all non-;# characters from the input, then searches for the regex ;*#, which finds runs of ; characters followed by a # character. The match.length attribute of this (retrieved using 'm' for short) indicates the number of matched characters, of which the last one must be the #, and all the previous ones ;s. So we subtract one and convert to utf8 characters.

  • \$\begingroup\$ Why not just ;*# (instead of [^#]*#) in the gregexpr if you've removed all the non-;# characters? \$\endgroup\$
    – Giuseppe
    Commented Oct 1, 2020 at 17:20
  • \$\begingroup\$ Yes! You're right! Thanks! I 'probably' left this in from an earlier attempt, but most-likely just didn't think of it... \$\endgroup\$ Commented Oct 1, 2020 at 17:55

ThumbGolf, 24 bytes

Hexdump (little endian):

293b bf08 1c40 2923 d103 dec3 007f de10
2000 de19 d0f4 4770 

The program starts 16 bytes in at the 2000.

Commented assembly:

        // Include the ThumbGolf wrapper macros
        .include "thumbgolf.inc"
        // main starts below
        // first check for semicolon
        cmp     r1, #';'
        // if equal, increment the accumulator
        it      eq
        addeq   r0, r0, #1
        // now check for hash
        cmp     r1, #'#'
        // skip if not equal (ThumbGolf doesn't work in IT blocks, unfortunately)
        bne     .Lnoprint
        // modulo accumulator by 127
        umodi   r0, r0, 127
        // print accumulator
        putc    r0
        // -- fallthrough --
        // start here because why not (both print and entry need to reset the
        // accumulator, so it is convenient to do it here)
        .globl main
        // reset accumulator to zero
        movs    r0, #0
        // read next char into r1, sets zero flag on success
        getc    r1
        // if successful, continue interpreting
        beq     .Lloop
        // else return
        bx      lr

I actually found a bug in my recent refactor of ThumbGolf with this code.

When I executed getc, the illegal handler would trigger as normal, then trigger on the next instruction. After 2 hours fiddling with it, I realized that when switching the CPSR to use a nice bitfield struct, I forgot to account for some unused bits. This caused me to set the IT_D flag instead of the Z flag, putting the processor in a bad IT state, causing the crash. 😂


Pxem, 0 bytes (for content) + 50 bytes (for filename).

  • Filename (unprintables are escaped): M\177.w.i.c;.-\001.y.s\001.+;;;.a.c#.-\001.y.s\177.%.o###\177.a\001.+.a
  • Content is empty.


  • Full program.
  • I/O with stdin and stdout.
  • Accepts one program at once.

With comments

# let counter is 127
# loop
  # c = getchar()
  # increment here
  # output and reset here
# break if c is EOF

Try it online!


Racket, 122 bytes

(let([n 0])(for([i s])(cond[(eq? i #\;)(set! n(+ 1 n))][(eq? i #\#)(display(integer->char(remainder n 127)))(set! n 0)])))

Try it online!


Assembly (MIPS, SPIM), 108 bytes

c:li$4 0
add$5 1
beqz$2 e
beq$2 35p
bne$2 59l
add$4 1
bge$4 127c
j l
p:li$2 11
j c

TIO includes test cases.

Try it online!

This is a function which takes a null terminated string in $a1 and prints the result to stdout.

Ungolfed version with comments:

    # Input: Null terminated byte string in $a1
    # Output: Printed to stdout
    li      $a0, 0             # Clear accumulator
    lb      $v0, ($a1)         # Load char from program string
    add     $a1, 1             # Advance pointer
    beqz    $v0, .Lreturn      # If char was '\0', return
    beq     $v0, '#', .Lprint  # If char was '#', print
    bne     $v0, ';', .Lloop   # If not ';', loop again
    add     $a0, 1             # Increment accumulator
    bge     $a0, 127, .Lclear  # Clear accumulator if it is >= 127
    j       .Lloop             # Otherwise loop
    li      $v0, 11            # 11 = PRINT CHARACTER
    syscall                    # putchar($a0)
    j       .Lclear            # Clear accumulator and loop again
    j       $ra                # Return

jq -Rr, 46 bytes

Splitting and counting


Try it online!


Ly, 33 bytes


Try it online!

A different take using Ly

0sp                                - init backup cell to "0"
   ir                              - read input as codepoints and reverse stack
     [                           ] - loops once for each input char
      ';=                          - is it a ";"?
         [    ]p                   - then clause if true
          l                        - load the accumulate value
           +                       - increment by 1 ("if" result is on stack)
            s                      - update backup cell
             !                     - change top of stack to "0" to exit loop
               p                   - delete "if" result
                "#"=               - is is a "#"?
                    [        ]     - then clause if true
                     l             - load backup cell
                      '~`          - generate the number "127"
                         %         - calculate modulo w/ 127
                          o        - print top of stack as char
                           !       - convert to "0" (1)
                            s      - reset backup cell to "0"
                               p   - delete "if" result
                                p  - delete character we just processed

Note(1): If the input tries to print a null (meaning x'00') the code will fail. If that's a requirement I can tweak the code to harden it against that. I think it would just add one more character... Printing nulls sounds like a mistake though, so I'm not sure it's necessary?


batch, 293 bytes

@Echo off& Set f=For /f "UsebackQ Delims=" %%z in
Setlocal EnableDelayedExpansion&%f% ("%~1")Do (Set "l=%%~z"&Set "l=!l:;=-!"&%f:z=G% (`cmd/u/c ^"Echo(!l!^"^|find/v ""^|findstr "^^"`)Do (If %%G==- (Set/a i=i%%127+1)Else if %%G==# ((CMD /C Exit !i!)&<nul Set/p "=ESC7!=EXITCODEASCII!"&Set i=0)))

This interpreter contain an unprintable escape character (0x1b), marked by the presence of the string ESC To obtain a version containing the escape character, visit: https://pastebin.com/Y6vUi9A7

The use of the Escape sequence prevents syntax errors that occur when outputting strings with leading whitespace or = characters via set /p

Run from cmd.exe command line providing the filepath as arg 1, using doublequotes if the file path contains spaces, IE: Interpreter.bat path\to\filename.extension Each line of the program must be doubequoted, Example Helloworld.sch: ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;# "


%= Supress command echoing =% @Echo off
%= Define command as macro with the FOR metavariable being replaced via substitution =% Set f=For /f "UsebackQ Delims=" %%z in
%= Enable 'runtime' expansion of vars within codeblocks =% Setlocal EnableDelayedExpansion
%= For each line in Arg 1 sourcefile =% %f% ("%~1")Do (
%= Assign line and replace semicolons with a non-standard delim =%    Set "l=%%~z"&Set "l=!l:;=-!"
%= Split string by character and for each character do =% %f:z=G% (`cmd/u/c ^"Echo(!l!^"^|find/v ""^|findstr "^^"`)Do (
%= Assess character =% If %%G==- (
%= increment accumulater =% Set/a i=i%%127+1
        )Else if %%G==# (
%= Convert Accumulator to Ascci character =% CMD /C Exit !i!
%= Output and reset Accumulator =% <nul Set/p "=ESC7!=EXITCODEASCII!"&Set i=0
)   )   )

(,), 305 Chars or \$305\log_{256}(3)\approx\$60.43 Bytes


More readable version (I don't actually write in psuedo-code):



Quite Slow. Also doesn't work when input contains non-;# characters.


Morsecco:  206  203 bytes

writing an interpreter for a two-symbol language using a three-symbol language seems to be a fair challenge:

.   -- . -- . --.-  . . .--
. . . - .-.
-- - -.-. - -.- .- . .-...-- .- --..
 . .--... .- --.. --.
- .- --. - . . - .- . .------- .- - - --.. .-. . ------- .- - .-. - . --.
 - . -.- - . - .-- . . - . --.

The first line creates an error handler (code written to special address .) to quit the program without error if the input is used up. Everything else is pretty straight forward. Without having MOD or compare I always add -127, adding 127 again if the result was not zero. Maybe I can think of a shorter solution on another day.


Vyxal 3, 12 bytes


Try it Online!


Swift, 97 bytes

var a=0,s="",f={(($0+"").map{a=$0==";" ?a+1:$0=="#" ?(s+="\(UnicodeScalar(a%127)!)",0).1:a},s).1}

F#, 165 162 bytes

-3 bytes, thanks to Random User

let g a=
 let mutable b=0
 let mutable d=""
 for c in a do
  if c=';' then
  elif c='#' then

It's basically a port of my C# answer.

  • 2
    \$\begingroup\$ let golf a? golf?! Why? \$\endgroup\$ Commented May 21, 2017 at 19:38
  • \$\begingroup\$ @RandomUser I don't know, but I shortened it. \$\endgroup\$ Commented May 21, 2017 at 19:40

Python 3, 66 bytes

for c in input():a-=a*(c=='#'!=print(end=chr(a%127)))-(c==';')

Try it online!


Java 8, 112 bytes

This expression is a Consumer<String>, so it assumes s is a String.

(s)->{int i=0;for(char c:s.toCharArray()){if(c==';')i++;else if(c=='#'){System.out.print((char)(i%127));i=0;}}};

AHK, 83 bytes

Send % Chr(Mod(i,127))

By default, Loop,Parse will parse each character individually.

I had a 76 bytes version based on splitting the input on # but, as pointed out by manatwork as a comment, it'll print the very last section even without a # at the end.

Send % Chr(Mod(StrLen(RegExReplace(A_LoopField,"[^;]")),127))
  • \$\begingroup\$ Sure this prints only on #? I mean, sure ;;#;;; will result #2 and not #2#3? \$\endgroup\$
    – manatwork
    Commented May 22, 2017 at 13:15
  • \$\begingroup\$ @manatwork Good point. I had to rewrite it at the expense of 7 bytes. Thanks. \$\endgroup\$ Commented May 22, 2017 at 13:42

Ruby, 71 50 bytes


Edit: Complete rewrite. manatwork's solution is still shorter, but this does it a slightly different way!

  • \$\begingroup\$ You can replace $><<(xxx).chr with putc xxx for -5 bytes. \$\endgroup\$
    – Jordan
    Commented Dec 16, 2017 at 17:32

Fourier, 32 bytes


Try it on FourIDE!

Enter the program between quotation marks.

Explanation Pseudocode

While i != Input length
    Q = Pop character off start of string and get char ASCII code
    If Q = 59 Then
        Increment A
    End If
    If Q = 35 Then
        Convert A mod 127 to character and Print
        A = 0
    End If
    Increment i
End While

Actually, 20 bytes


Try it online!


'#@s                  split on "#"
    ⌠';@c7╙D@%c⌡M     for each chunk:
     ';@c               count occurrences of ";"
         7╙D@%          mod by 127 (2**7-1)
              c         convert to ASCII char
                 dX   discard last item
                   Σ  concatenate

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.