Group() Groups() & Groupdict()
-
Practice>Python>Regex and Parsing>Group(), Groups() & Groupdict()hackerrank.com 2019. 3. 29. 13:09
hackerrank.com Group(), Groups() & Groupdict() Problem Link : https://www.hackerrank.com/challenges/re-group-groups/problem Difficulty : Easy Tip a-zA-Z0-9 this to capture both alphabet and number Solution import re m = re.search(r'([a-zA-Z0-9])\1+', input().strip()) print(m.groups()[0] if m else -1)