You are viewing a single comment's thread. Return to all comments →
Try with the script below on python and thank me later:)
def alternate(s): valid_substrings = [] for first, second in combinations(set(s), 2): pattern = "[^" + first + second + "]" substring = re.sub(pattern, '', s) if not re.search(r'([a-z])\1', substring): valid_substrings.append(substring) return max([len(i) for i in valid_substrings]) if valid_substrings else 0
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 →
Try with the script below on python and thank me later:)