You are viewing a single comment's thread. Return to all comments →
I kinda came up with a long logic with python making use of itertools
def alternate(s): results=[] st=list(set(s)) if len(st)<2: return 0 else: combos=list(combinations(st,len(st)-2)) print(combos) for i in combos: vals=[] temp=s for x in i: temp=temp.replace(x,"") print(temp) for y in range(len(temp)-1): if temp[y]==temp[y+1]: vals.append(False) else: vals.append(True) if all(vals)==True: results.append(len(temp)) else: results.append(0) return max(results)
Seems like cookies are disabled on this browser, please enable them to open this website
Two Characters
You are viewing a single comment's thread. Return to all comments →
I kinda came up with a long logic with python making use of itertools