Group(), Groups() & Groupdict()

  • + 0 comments
    #Below Python 3.8 :
    import re
    s = input()    
    print(s[re.search(r'([a-zA-Z\d])\1', s).start()]) if re.search(r'([a-zA-Z\d])\1', s) else print("-1")
    #Since Python 3.8
    print(s[match.start()]) if (match := re.search(r'([a-zA-Z\d])\1', s)) else print("-1")