Skip to content

Instantly share code, notes, and snippets.

@Kuzyashin
Created November 17, 2018 20:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kuzyashin/df6ee650c067e025bf1c254ea538cf71 to your computer and use it in GitHub Desktop.
Save Kuzyashin/df6ee650c067e025bf1c254ea538cf71 to your computer and use it in GitHub Desktop.
step_dna.py
s = str(input())
l = len(s)-1
c = 1
t = ''
if len(s) == 1:
t = t + s +str(c)
else:
for i in range(0,l):
if s[i] == s[i+1]:
c += 1
elif s[i] != s[i+1]:
t = t + s[i]+str(c)
c = 1
for j in range(l, l+1):
if s[-1] == s[-2]:
t = t + s[j]+str(c)
elif s[-1] != s[-2]:
t = t + s[j]+str(c)
c = 1
print(t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment