fork(1) download
  1. from sys import exit
  2.  
  3. ROT13 = 13
  4. ROT5 = 5
  5.  
  6. lettersU = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
  7. lettersD = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
  8. numbers = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0']
  9.  
  10.  
  11. def getEncIndex(in_array, begin_index):
  12.  
  13. end_index = begin_index + ROT13
  14. if end_index >= len(in_array):
  15. shift = end_index - (len(in_array) - 1)
  16. end_index = -1 + shift
  17.  
  18. return end_index
  19.  
  20.  
  21. def crypt(in_array, sign):
  22. begin_index = in_array.index(sign)
  23. end_index = getEncIndex(in_array, begin_index)
  24. return in_array[end_index]
  25.  
  26.  
  27. x = ""
  28. y = ""
  29. while 1 == 1:
  30. try:
  31. inp = input()
  32. if x == "":
  33. x = inp
  34. else:
  35. x+= "\n" + inp
  36. except EOFError:
  37. break
  38.  
  39.  
  40. if x == "":
  41. print(x)
  42. exit()
  43.  
  44. for i in x:
  45. if i in lettersU:
  46. y += crypt(lettersU, i)
  47. elif i in lettersD:
  48. y += crypt(lettersD, i)
  49. elif i in numbers:
  50. y += crypt(numbers, i)
  51. else:
  52. y += i
  53.  
  54. print(y)
  55.  
  56.  
Success #stdin #stdout 0.02s 9200KB
stdin
Hello World!
DAS23dsaf 31 24+ 2314 3-'[;
Panie Prezesie toniemy w dlugach!
stdout
Uryyb Jbeyq!
QNF56qfns 64 57+ 5647 6-'[;
Cnavr Cermrfvr gbavrzl j qyhtnpu!