You are viewing a single comment's thread. Return to all comments →
Python using combinations
def alternate(s): comb = list(combinations(set(s), 2)) len_max = 0 for i in comb: txt = s txt = "".join(c for c in txt if c in i) if re.search(r"(.)\1", txt): continue else: if len(txt) > len_max: len_max = len(txt) return len_max
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Two Characters
You are viewing a single comment's thread. Return to all comments →
Python using combinations