Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import math
- # Auto-generated code below aims at helping you parse
- # the standard input according to the problem statement.
- m = [c for c in input().upper() if c.isalpha()]
- for a,b in zip(m,m[1:]):
- if a!=b:
- d=b>a
- break
- r=[]
- for a,b in zip(m,m[1:]):
- if b>a:
- r+=1,
- elif b<a:
- r+=0,
- else:
- r+=r[-1] if r else d,
- r = [r[0]]+r
- from itertools import*
- res=[]
- for k,v in groupby(r):
- l=len([*v])
- res+=str(l),
- print(*res,sep='-')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement