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.
for i in range(0,len(s)-1):
if(s[i]!=s[i+1]):
l1.append(s[i])
l2.append(c+1)
c=0
else:
c+=1
for i in range(0,len(l2)):
for j in range(i+1,len(l2)):
if(l2[i]
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Company Logo
You are viewing a single comment's thread. Return to all comments →
Solution without using collections
s=input() l1=[] l2=[] s=sorted((s)) c=0
for i in range(0,len(s)-1): if(s[i]!=s[i+1]): l1.append(s[i]) l2.append(c+1) c=0 else: c+=1 for i in range(0,len(l2)): for j in range(i+1,len(l2)): if(l2[i]