Created
October 17, 2016 15:10
-
-
Save linxlunx/2c005e2688835afe33edef9cf144fe07 to your computer and use it in GitHub Desktop.
Count input characters
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
#!/usr/bin/env python | |
# only need a few minutes if I calm down | |
# aaarrrgggh | |
string = raw_input() + " " | |
texts = list(string) | |
final_texts = "" | |
x = 0 | |
for num in xrange(len(texts)-1): | |
if texts[num] != texts[num+1]: | |
final_texts += texts[num] | |
x += 1 | |
if x - 1 != 0: | |
final_texts += str(x) | |
x = 0 | |
else: | |
x += 1 | |
print final_texts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment