fork download
  1. # Convert BrainF*** into Unary
  2. # This prints the length of the resulting Unary program, which is merely a string of zeros.
  3.  
  4. s="-[------->+<]>-.---.+++++++.++++.[----->++<]>+."
  5. bf="><+-.,[]"
  6. u=""
  7. for i in s:
  8. n=str(bin(bf.index(i)))[2:]
  9. while len(n)<3:
  10. n="0"+n
  11. u+=n
  12. u="1"+u
  13.  
  14. #print u
  15. l=long(u,2)
  16. print l
  17.  
Success #stdin #stdout 0.01s 7736KB
stdin
Standard input is empty
stdout
4112944349030977576093535992182460943769108