Group(), Groups() & Groupdict()

Sort by

recency

|

250 Discussions

|

  • + 0 comments
    import re
    print((m := re.search(r"([a-zA-Z0-9])\1", input())) and m.group(1) or -1)
    
  • + 0 comments
    import re
    print((lambda m: m.group(1) if m else -1)(re.search(r"([a-zA-Z0-9])\1", input())))``
    
  • + 0 comments

    import re a=input() m=re.search(r'([a-z A-Z 0-9])\1', a) print(m.groups()[0]) if m else print(-1)

  • + 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')
    
  • + 0 comments
    import re
    pattern = r'([A-Za-z0-9])\1+'
    l = re.findall(pattern , input().strip())
    print( l[0] if len(l) != 0 else -1)