Advertisement
Guest User

Untitled

a guest
Jan 26th, 2020
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. import sys
  2.  
  3. string = input()
  4. if len(string) == 0:
  5. print('COMPRESSION FAILED')
  6. sys.exit()
  7.  
  8. step1 = []
  9. for word in string.split(' '):
  10. if '12' in word:
  11. twelve = ''
  12. f = word.find('12')
  13. twelve += (list(word).pop(f) + list(word).pop(f+1))
  14. step1.append(twelve)
  15. else:
  16. alpha = ''
  17. for c in word:
  18. if c.isalpha():
  19. alpha += c
  20. step1.append(alpha)
  21.  
  22. if len(step1) == 0:
  23. print('COMPRESSION FAILED')
  24. sys.exit()
  25. print('STEP 1: ',' '.join(step1), sep='')
  26.  
  27. step1 = ' '.join(step1)
  28. step2 = ''
  29. for char in step1:
  30. if char.isalpha():
  31. if char in 'aeiouAEIOU':
  32. step2 += char.upper()
  33. else:
  34. step2 += char.lower()
  35. else:
  36. step2 += char
  37. print('STEP 2: ', step2, sep='')
  38.  
  39. step3a = []
  40. step3b = []
  41. step2 = step2.split(' ')
  42. for word in step2:
  43. if word == '':
  44. step2.remove(word)
  45. for word in step2:
  46. if step2.index(word) % 2 == 0:
  47. oddw = ''
  48. for c in list(word):
  49. if list(word).index(c) % 2 == 0:
  50. oddw += c
  51. step3a.append(oddw)
  52. else:
  53. step3b.append(word[len(word)//2:])
  54. print('STEP 3: ', ' '.join(step3a), '#', ' '.join(step3b), sep='')
  55.  
  56. print(' '.join(step3b))
  57. print(step2.index('12'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement