Advertisement
Guest User

Untitled

a guest
Feb 28th, 2020
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. Answer should be 1 to 255
  2. ,[ take INPUT and begin main loop; process until EOF
  3. >+++++[>++++++++<-] insert 40 "(" into memory (MEM: INPUT _TMP_ 40 ACC)
  4. >[-<<->>]<< subtract 40 from INPUT and go there
  5. [>>>--<<<[-]] if INPUT not 0: subtract 2 from ACC and zero INPUT
  6. >>>+<<< if we skipped inc ACC; otherwise ACC ends up decremented
  7. , read some more input
  8. ] loop continues until we hit EOF
  9. >>>+ move over to ACC and add one for the newline
  10. print integer function (copied from the internet)
  11. [>>+>+<<<-]>>>[<<<+>>>-]<<+>[<->[>++++++++++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]
  12. ++++++++[<++++++>-]>[<<+>>-]>[<<+>>-]<<]>]<[->>++++++++[<++++++>-]]<[.[-]<]
  13. ++++++++++.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement