fork(25) download
  1. import fileinput
  2. import functools
  3.  
  4. def codeToChar(x):
  5. if x == '':
  6. return '';
  7. mapping = {'.': '0', '2': '1', '3': '2'}
  8. # get ternary value and map to a-z, then caesar cipher by 12
  9. return chr(ord('a') + (int(''.join([mapping[c] for c in x]), base=3) + 12) % 26)
  10.  
  11. for line in fileinput.input():
  12. chars = [codeToChar(x) for x in line.split('-')]
  13. print("".join(chars))
  14. """
  15. 3.2-..3-.23-.32-32.-3..-..2-223-.32-322-..3-..2-2.2-3..-232-223-..2-.32-3.2-..3-.23-3.3-..3-.32-32.-322-.3.-.3-33.-22.-23.-..3-.23-..2-3..-2.2-..3-2.2-3..-.23-23.-.33-.32-2.2-3..-3.2-223-322-332-3..-233
  16. => forthenationwecantforgothisokybornewowerbutwefailed
  17. """
Success #stdin #stdout 0.02s 9756KB
stdin
3.2-..3-.23-.32-32.-3..-..2-223-.32-322-..3-..2-2.2-3..-232-223-..2-.32-3.2-..3-.23-3.3-..3-.32-32.-322-.3.-.3-33.-22.-23.-..3-.23-..2-3..-2.2-..3-2.2-3..-.23-23.-.33-.32-2.2-3..-3.2-223-322-332-3..-233-
stdout
forthenationwecantforgothisokybornewowerbutwefailed