Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. x = input()
  2. i = 0
  3. cnt = 1
  4. while (i < len(x)) :
  5. if (x[i] == x[i+1]) :
  6. cnt = cnt + 1
  7. else:
  8. print(x[i], end='')
  9. print(cnt, end='')
  10. cnt=1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement