Created
November 26, 2014 10:51
-
-
Save holyketzer/5d2a19dd89973bf975a8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 __future__ import print_function | |
dna = raw_input('Enter dna:') | |
i = 1 | |
count = 1 | |
while i < len(dna): | |
if dna[i] != dna[i - 1]: | |
print(str(count) + dna[i - 1], end='') | |
count = 1 | |
else: | |
count += 1 | |
i += 1 | |
print(str(count) + dna[i - 1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment