Created
June 3, 2016 13:38
-
-
Save vaibhavgeek/5795a1256440f76a6523474458516e88 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import Counter | |
from itertools import groupby | |
strs=raw_input() | |
count = 0 | |
answer = '' | |
for k, g in groupby(strs): | |
count = len(list(g)) | |
if (count > 1) and (k != ' '): | |
answer = answer + k + str(count) | |
else: | |
answer = answer + k | |
print answer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment