HackerRank Python - Re.findall() & Re.finditer()
re.findall()
The expression re.findall() returns all the non-overlapping matches of patterns in a string as a list of strings.
re.finditer()
The expression re.finditer() returns an iterator yielding MatchObject instances over all non-overlapping matches for the re pattern in the string.
- # Enter your code here. Read input from STDIN. Print output to STDOUT
-
- import re
-
- vowels = 'aeiou'
- consonants = 'qwrtypsdfghjklzxcvbnm'
- match = re.findall(r'(?<=[' + consonants + '])([' + vowels + ']{2,})(?=[' + consonants + '])', input(), flags=re.I)
- print('\n'.join(match or ['-1']))