Group(), Groups() & Groupdict()

  • + 0 comments
    import sys, re
    
    S = sys.stdin.read()
    S = re.sub(r"[\W|_]*", '', S)
    
    match = re.search(r"(\w)\1{1,}", S)
    
    if match:
        print(match.group()[0])
    else:
        print('-1')