;#
is a very simple language. It has 2 commands:
;
will increment the accumulator#
outputs the accumulator modulo 127, and then resets the accumulator
;$
is also very simple and is very similar (and also does not yet exist). It has 2 commands:
;
will increment the accumulator$
outputs the accumulator modulo 127. However, it does not reset the accumulator.
Challenge
Create a program that will convert ;#
code to ;$
code. That is, given input a
using standard methods, output he shortest b
such that a
in ;#
outputs the same thing as b
in ;$
. The input will only contain the characters ';'
and '#'
. The input will not have trailing semicolons. That is, it will match the regex (;*#)+
. This also means input will not be blank. Note that ;;;;##
is possible (equivalent to ord(4) ord(0)
).
Examples
;# code -> ;$ code
;;;;;;;;;;#;;;;;;;;;;;;# -> ;;;;;;;;;;$;;$
;;;;;;;;;;;;;;#;;;# -> ;;;;;;;;;;;;;;$;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;$
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;$;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;$;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;$ (Hello, World!)
;#
questions going around. They're not very interesting. \$\endgroup\$;#
challenges; it was the first one after the compiler and the transpiler IIRC. \$\endgroup\$;#
input shortest one? \$\endgroup\$