Advertisement
DimaT1

Egor

Feb 8th, 2018
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. alpha = 'abcdefghijklmnopqrstuvwxyz'
  2. Alpha = alpha.upper()
  3.  
  4. s = input()
  5. n = 0
  6. IN = False
  7. counter = 0
  8. for c in s:
  9.     if c in alpha+Alpha:
  10.         if IN:
  11.             counter += 1
  12.         else:
  13.             IN = True
  14.             counter = 1
  15.     else:
  16.         if IN:
  17.             IN = False
  18.             n = max(n, counter)
  19.  
  20. res = ''
  21. for c in s:
  22.     if c in alpha:
  23.         res += alpha[(alpha.index(c) + n) % len(alpha)]
  24.     elif c in Alpha:
  25.         res += Alpha[(Alpha.index(c) + n) % len(Alpha)]
  26.     else:
  27.         res += c
  28. print(res)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement