Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- test_string = input()
- regEx = '([a-z])\\1'
- steps = 0
- while len(list(re.findall(regEx, test_string))) != 0:
- test_string = re.sub(regEx, '', test_string, 1)
- steps += 1
- if len(test_string) > 0:
- print(test_string)
- else:
- print("Empty String")
- print("{0} operations".format(steps))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement