Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cph = list(input())
- icph = []
- x, y = 0, 0
- cph.append('s')
- for i in cph:
- if i == 's':
- if x > 0:
- icph.append('x' + str(x))
- if y > 0:
- icph.append('y' + str(y))
- break
- elif i == 'x':
- x = x + 1
- elif i == 'y':
- y = y + 1
- elif i == 'x' and y > 0:
- x = x + 1
- icph.append('y' + str(y))
- y = 0
- elif i == 'y' and x > 0:
- y = y + 1
- icph.append('x' + str(x))
- x = 0
- print(icph)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement