We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Group(), Groups() & Groupdict()
Group(), Groups() & Groupdict()
Sort by
recency
|
260 Discussions
|
Please Login in order to post a comment
import re
S = input()
m = re.search(r'([a-zA-Z0-9])\1+', S)
if m: print(m.group(1)) else: print(-1)
from itertools import groupby import re
S = input() X = re.findall(r'[A-Za-z0-9]', S) alphanumeric = ''.join(X) groups = [char for char, group in groupby(alphanumeric) if len(list(group))>1] if len(groups)>0: print(groups[0]) else: print('-1')
import re match = re.search(r'([A-Za-z0-9])\1', input()) print(match.group(1) if match else -1)
import re
s = input()
digits = re.findall(r'(.)\1+', s)
for char in digits: if char.isalnum(): print(char) break
else: print(-1)