You are viewing a single comment's thread. Return to all comments →
def superReducedString(s): ans=list(s) cha=1 while cha==1: cha=0 for i in range(len(ans)-1): if ans[i]==ans[i+1]: ans[i]='0' ans[i+1]='0' prev=ans[:] ans= [num for num in ans if num != '0'] if prev!=ans: cha=1 if ans ==[]: return 'Empty String' return ''.join(ans)
Seems like cookies are disabled on this browser, please enable them to open this website
Super Reduced String
You are viewing a single comment's thread. Return to all comments →