Skip to content

Instantly share code, notes, and snippets.

@holyketzer
Created November 26, 2014 10:51
Show Gist options
  • Save holyketzer/5d2a19dd89973bf975a8 to your computer and use it in GitHub Desktop.
Save holyketzer/5d2a19dd89973bf975a8 to your computer and use it in GitHub Desktop.
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