brainfudge/test/length.bf

20 lines
818 B
Brainfuck
Executable File

#lang reader "reader.rkt"
,.>>+<<[,.>>+<<] this is the simple cat program it reads in a value then moves 2 to the right and adds 1 to the counter then moves back to the input cell again
>++++++++++++++++++++++++++++++++.[-] we leave the 2nd print the space
>- Have to subtract 1 because otherwise it will include the eof character
>>++++++++++<<[->+>-[>+>>]>[+[-<+>]>+>>]<<<<<<]>> in cell do N modulo 10
[-]>>>++++++++++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]> in cell do N modulo 10
[-]>>[>++++++[-<++++++++>]<. print hundreds
<<+>+>[-]]<[<[->-<]++++++[->++++++++<]>.[-]] print tens
<<++++++[-<++++++++>]<. print ones
[-]<<[-<+>]< cleanup
[-] reset the buffer
++++++++++. print newline
test input
!Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque gravida arcu id arcu eleifend pulvinar. Sed metus.