We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Itertools
- Compress the String!
- Discussions
Compress the String!
Compress the String!
Sort by
recency
|
872 Discussions
|
Please Login in order to post a comment
from itertools import groupby
A = input()
B =groupby(A)
for i, k in B: print((len(list(k)), int(i)), end=" ")
from itertools import groupby s1=(input()) list1=[] for k, g in groupby(s1):
list1.append((len(tuple(g)),int(k))) print(*list1)