Input Format
A single line of input containing the string .
Constraints
Output Format
Print the first occurrence of the repeating character. If there are no repeating characters, print -1.

hackerrank group groups and groupdict problem solution in python programming

Problem solution in Python 3 programming language.

import re
m = re.search(r'([A-Za-z0-9])\1+',input())
if m:
    print(m.group(1))
else:
    print(-1)

Second solution

# Enter your code here. Read input from STDIN. Print output to STDOUT
import re
m = re.findall(r"([A-Za-z0-9])\1+",input())
if m:
    print(m[0])
else:
    print(-1)

Problem solution in Python 2 programming language.

import re
m = re.search(r'([A-Za-z0-9])\1+',raw_input())
if m:
    print m.group(1)
else:
    print -1