Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- string = input()
- if len(string) == 0:
- print('COMPRESSION FAILED')
- sys.exit()
- step1 = []
- for word in string.split(' '):
- if '12' in word:
- twelve = ''
- f = word.find('12')
- twelve += (list(word).pop(f) + list(word).pop(f+1))
- step1.append(twelve)
- else:
- alpha = ''
- for c in word:
- if c.isalpha():
- alpha += c
- step1.append(alpha)
- if len(step1) == 0:
- print('COMPRESSION FAILED')
- sys.exit()
- print('STEP 1: ',' '.join(step1), sep='')
- step1 = ' '.join(step1)
- step2 = ''
- for char in step1:
- if char.isalpha():
- if char in 'aeiouAEIOU':
- step2 += char.upper()
- else:
- step2 += char.lower()
- else:
- step2 += char
- print('STEP 2: ', step2, sep='')
- step3a = []
- step3b = []
- step2 = step2.split(' ')
- for word in step2:
- if word == '':
- step2.remove(word)
- for word in step2:
- if step2.index(word) % 2 == 0:
- oddw = ''
- for c in list(word):
- if list(word).index(c) % 2 == 0:
- oddw += c
- step3a.append(oddw)
- else:
- step3b.append(word[len(word)//2:])
- print('STEP 3: ', ' '.join(step3a), '#', ' '.join(step3b), sep='')
- print(' '.join(step3b))
- print(step2.index('12'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement