You are viewing a single comment's thread. Return to all comments →
a=input() s='' for i in range(0,len(a)): if i!=0: if a[i]==a[i-1]: continue p=0 for j in range(i,len(a)): if a[i]==a[j]: p+=1 else: break s+='('+str(p)+', '+a[i]+')'+' ' print(s)
my python3 approach without groupby and passes all the test cases but more lenghty as compare to groupby
Compress the String!
You are viewing a single comment's thread. Return to all comments →
my python3 approach without groupby and passes all the test cases but more lenghty as compare to groupby