Advertisement
ivandrofly

coding-game (clash of codes)

Mar 13th, 2021
1,337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.69 KB | None | 0 0
  1.  
  2. #            S   M   L
  3. # SIMPLE =>   \ / \ / \   => SMLIPE
  4. #              I   P   E
  5.  
  6.  
  7.  
  8.  
  9. import sys
  10. import math
  11.  
  12. # Auto-generated code below aims at helping you parse
  13. # the standard input according to the problem statement.
  14.  
  15. s = input()
  16. # Write an answer using print
  17. # To debug: print("Debug messages...", file=sys.stderr, flush=True)
  18. if len(s)%2:
  19.     first = s[:len(s)//2+1]
  20.     second = s[len(s)//2+1:]
  21. else:
  22.     first = s[:len(s)//2]
  23.     second = s[len(s)//2:]
  24.  
  25. z=0
  26. f=""
  27. for i in range(len(s)):
  28.     if z%2:
  29.         f+=second[z//2]
  30.     else:
  31.         try:
  32.             f+=first[z//2]
  33.         except:
  34.             f+=second[z//2]
  35.     z+=1
  36.  
  37. print(f)
  38.  
  39. # NOTE: NOT MINE!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement