re.findall()

The expression re.findall() returns all the non-overlapping matches of patterns in a string as a list of strings. 

Code

>>> import re
>>> re.findall(r'\w','http://www.hackerrank.com/')
['h', 't', 't', 'p', 'w', 'w', 'w', 'h', 'a', 'c', 'k', 'e', 'r', 'r', 'a', 'n', 'k', 'c', 'o', 'm']

re.finditer()

The expression re.finditer() returns an iterator yielding MatchObject instances over all non-overlapping matches for the re pattern in the string. 

Code

>>> import re
>>> re.finditer(r'\w','http://www.hackerrank.com/')
<callable-iterator object at 0x0266C790>
>>> map(lambda x: x.group(),re.finditer(r'\w','http://www.hackerrank.com/'))
['h', 't', 't', 'p', 'w', 'w', 'w', 'h', 'a', 'c', 'k', 'e', 'r', 'r', 'a', 'n', 'k', 'c', 'o', 'm']

Task 

You are given a string $\mbox{S}$. It consists of alphanumeric characters, spaces and symbols(+,-). 

Your task is to find all the substrings of $\mbox{S}$ that contains $2$ or more vowels. 

Also, these substrings must lie in between $2$ consonants and should contain vowels only.

Note : 

Vowels are defined as: AEIOU and aeiou. 

Consonants are defined as: QWRTYPSDFGHJKLZXCVBNM and qwrtypsdfghjklzxcvbnm.

Input Format

A single line of input containing string $\mbox{S}$.

Constraints

$0<len(S)<100$

Output Format

Print the matched substrings in their order of occurrence on separate lines. 

If no match is found, print -1.

Sample Input
rabcdeefgyYhFjkIoomnpOeorteeeeet

Sample Output
ee
Ioo
Oeo
eeeee

Explanation

ee is located between consonant $\boldsymbol{d}$ and $\mbox{f}$. 

Ioo is located between consonant $\boldsymbol{k}$ and $m$. 

Oeo is located between consonant $\boldsymbol{p}$ and $\textbf{r}$. 

eeeee is located between consonant $\boldsymbol{\boldsymbol{t}}$ and $\boldsymbol{\boldsymbol{t}}$.

Difficulty: EASY

Starter code:

Solutions:
import re
matches = re.findall('(?<=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])[AEIOUaeiou]{2,}(?=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])', input())
if matches:
	for m in matches:
		print(m)
else:
	print(-1)


import re
S = input()
L = re.findall('(?<=[qwrtypsdfghjklzxcvbnmQWRTYPSDFGHJKLZXCVBNM])([aeiouAEIOU]{2,})(?=[qwrtypsdfghjklzxcvbnmQWRTYPSDFGHJKLZXCVBNM])', S)
if len(L) == 0:
	print(-1)
else:
	print(*L, sep='\n')


import re
s = input()
vowels = re.findall('(?<=[^AEIOUaeiou])([AEIOUaeiou]{2,})(?=[^AEIOUaeiou])', s)
if vowels:
	for g in vowels:
		print(g)
else:
	print(-1)


import re
m = re.findall('(?<=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])([AEIOUaeiouu]{2,})(?=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])', input())
if m:
	print(*m, sep='\n')
else:
	print(-1)


import re
s = input()
vowRegex = re.compile('(?<=[^aeiou 0-9])([aeiou]{2,})(?=[^aeiou 0-9])', re.I)
mo = vowRegex.findall(s)
if mo:
	for m in mo:
		print(m)
else:
	print(-1)


import re
s = input()
matches = re.findall('(?<=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])[AEIOUaeiou]{2,}(?=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])', s)
if matches:
	print('\n'.join(matches))
else:
	print(-1)


import re
vowels = 'aeiou'
consonants = 'qwrtypsdfghjklzxcvbnm'
p = re.compile('(?<=[' + consonants + '])([' + vowels + ']{2,})(?=[' + consonants + '])', flags=re.I)
a_str = input()
m = p.findall(a_str)
print('\n'.join(m or ['-1']))


import re
st = input()
cons = 'QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm'
vows = 'AEIOUaeiou'
match = re.findall('(?<=[' + cons + ']{1})([' + vows + ']{2,})(?=[' + cons + ']{1})', st)
if match:
	print(*match, sep='\n')
else:
	print('-1')


import re
s = input()
x = re.findall('(?<=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])([AEIOUaeiou]{2,})(?=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])', s)
if len(x) == 0:
	print(-1)
for i in x:
	print(i)


import re
v = '[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm]'
c = '[AEIOUaeiou]'
m = re.findall('(?<=' + v + ')' + c + '{2,}(?=' + v + ')', input())
print('\n'.join(m or ['-1']))


import re
S = input()
consonants = 'QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm'
vowels = 'AEIOUaeiou'
ci = re.finditer('(?=[' + consonants + ']([' + vowels + ']{2,})[' + consonants + '])', S)
L = list(map(lambda x: x.group(1), ci))
if len(L) > 0:
	print(*L, sep='\n')
else:
	print('-1')


import re
c = 'QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm'
v = 'AEIOUaeiuo'
l = re.findall('(?<=[' + c + '])[' + v + ']{2,}(?=[' + c + '])', input().strip())
print('\n'.join(l) if len(l) else '-1')


import re
pat = '(?<=[^aeiou])([aeiou]{2,})(?=[^aeiou])'
matches = re.findall(pat, input(), re.I)
if matches:
	print(*matches, sep='\n')
else:
	print(-1)


import re
s = input()
i = re.findall('(?<=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])[AEIOUaeiou]{2,}(?=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])', s)
print('\n'.join(i or ['-1']))


import re
print('\n'.join([m.group(1) for m in re.finditer('(?<=[qwrtypsdfghjklzxcvbnmQWRTYPSDFGHJKLZXCVBNM])([AEIOUaeiou]{2,})(?=[qwrtypsdfghjklzxcvbnmQWRTYPSDFGHJKLZXCVBNM])', input())]) or -1)


import re
string = input()
res = re.findall('(?<=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])[aeiouAEIOU]{2,}(?=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])', string)
if not res:
	print(-1)
else:
	for e in res:
		print(e)


import re
a = input()
consonants = 'QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm'
vowels = 'AEIOUaeiou'
match = re.findall('(?<=[' + consonants + '])([' + vowels + ']{2,})(?=[' + consonants + '])', a, flags=re.I)
print('\n'.join(match or ['-1']))


import re
pattern = '[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm]([AEIOUaeiou]{2,})(?=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])'
m = re.findall(pattern, input())
if m:
	for i in m:
		print(i)
else:
	print('-1')


import re
s = input()
l = [match[0] for match in re.findall('(?<=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])+(([aeiouAEIOU]){2,})+([QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])', s)]
if len(l) > 0:
	for item in l:
		print(item)
else:
	print(-1)


import re
y = re.findall('(?<=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])[aeiouAEIOU]{2,}(?=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])', input())
if len(y) > 0:
	print('\n'.join(y))
else:
	print('-1')


import re
m = re.findall('(?<=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])[AEIOUaeiou]{2,}(?=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])', input().strip())
print('\n'.join(m)) if m else print('-1')


import re
cons = 'QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm'
vowels = 'AEIOUaeiou'

def __starting_point():
	string = input().strip()
	m = re.findall('(?<=[%s])([%s]{2,})[%s]' % (cons, vowels, cons), string)
	print('\n'.join(m or ['-1']))
__starting_point()


import re

def main():
	s = input()
	found = False
	while s:
		m = re.search('[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm][AEIOUaeiou]{2,}[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm]', s)
		if m:
			found = True
			print(m.group()[1:-1])
			s = s[m.end() - 1:]
		else:
			break
	if not found:
		print(-1)
main()


import re
E = re.compile('(?<=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])[AEIOUaeiou]{2,}(?=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])')
S = input().strip()
L = re.findall(E, S)
if len(L) == 0:
	print(-1)
else:
	[print(group) for group in L]


import re
consonant = 'qwrtypsdfghjklzxcvbnmQWRTYPSDFGHJKLZXCVBNM'
vowel = 'AEIOUaeiou'
L = re.findall('(?<=[' + consonant + '])[' + vowel + ']{2,}(?=[' + consonant + '])', input())
if L:
	for element in L:
		print(element)
else:
	print(-1)


import re
pattern = re.compile('(?<=[^AEIOUaeiou\\d\\s+-]{1})([AEIOUaeiou]{2,})(?=[^AEIOUaeiou\\d\\s+-]{1})')
l = pattern.findall(input())
if len(l) == 0:
	print(-1)
else:
	for s in l:
		print(s)


import re
v = 'aeiou'
c = 'qwrtypsdfghjklzxcvbnm'
vowel_find = re.compile('(?<=[{c}])[{v}]{{2,}}(?=[{c}])'.format(c=c, v=v), re.I)
found = vowel_find.findall(input())
if not found == []:
	for m in found:
		print(m)
else:
	print('-1')


import re
s = input().strip()
matches = re.finditer('(?=([QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm]{1}[aeiouAEIOU]{2,}[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm]{1}))', s)
res = [match.group(1) for match in matches]
if len(res) == 0:
	print('-1')
else:
	print('\n'.join((x[1:-1] for x in res)))


import re
consonant = '[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm]'
vowel = '[AEIOUaeiou]'
rxp = consonant + '(' + vowel + '{2,})(?=' + consonant + ')'
m = re.findall(rxp, input())
if not m:
	print(str(-1))
else:
	for s in m:
		print(s)


import re
S = input()
b = False
for each in range(len(S) - 2):
	for j in range(each, len(S)):
		x = re.match('^[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm][AEIOUaeiou]{2,}[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm]$', S[each:j + 1])
		if x != None:
			print(S[each + 1:j])
			b = True
if b == False:
	print(-1)


import re
m = re.findall('.*?[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm]([AEIOUaeiou]{2,})(?=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])', input().rstrip())
if m == []:
	print(-1)
else:
	print('\n'.join(m))


import re

def isVowels(ch):
	return ch.lower() in 'aeiou'

def isValid(s, startPos, endPos):
	return endPos - startPos > 1 and startPos > 0 and (not isVowels(s[startPos - 1])) and (endPos < len(s)) and (not isVowels(s[endPos]))
s = input()
l = [it.group(0) for it in re.finditer('([AaEeIiOoUu]+)', s) if isValid(s, it.start(), it.end())]
print('\n'.join(l) if len(l) else '-1')


import re
s = input().strip()
m = re.findall('(?<=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])[AEIOUaeiou]{2,}(?=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])', s)
if m:
	print(*m, sep='\n')
else:
	print(-1)


import re
xs = input()
ls = re.findall('[^aeiou]*([aeiou][aeiou]+)[^aeiou]*', xs, re.IGNORECASE)
lhs = re.findall('[^aeiou]+([aeiou][aeiou]+)$', xs, re.IGNORECASE)
rhs = re.findall('^([aeiou][aeiou]+)[^aeiou]+$', xs, re.IGNORECASE)
if ls:
	ls = [l for l in ls if l not in lhs]
	if ls:
		ls = [l for l in ls if l not in rhs]
		if ls:
			print(*ls, sep='\n')
		else:
			print(-1)
	else:
		print(-1)
else:
	print(-1)


import re, string
S = input()
vows = 'aeiou'
vows += vows.upper()
cons = ''.join(set(string.ascii_letters).difference(vows))
l = re.findall('(?<=[{cons}])([{vows}][{vows}]+)(?=[{cons}])'.format(vows=vows, cons=cons), S)
print(*l, sep='\n') if l else print(-1)


import re
v = 'aeiou'
c = 'qwrtypsdfghjklzxcvbnm'
m = re.findall('(?<=[%s])([%s]{2,})[%s]' % (c, v, c), input(), flags=re.I)
print('\n'.join(m or ['-1']))


import re
m = re.findall('(?<=[bcdfghjklmnpqrstvwxyz])([aeiou]{2,})(?=[bcdfghjklmnpqrstvwxyz])', input(), re.I)
print(*(m if m else [-1]), sep='\n')


import re
l = re.findall('(?<=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])[AEIOUaeiou]{2,}(?=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])', input())
for item in l:
	print(item)
if len(l) == 0:
	print(-1)


import re
my_string = input().strip()
first_consonant = re.search('[QqWwRrTtYyPpSsDdFfGgHhJjKkLlZzXxCcVvBbNnMm]', my_string)
position = first_consonant.end()
vowel_strings = re.findall('[AaEeIiOoUu][AaEeIiOoUu][AaEeIiOoUu]*[QqWwRrTtYyPpSsDdFfGgHhJjKkLlZzXxCcVvBbNnMm]', my_string[position:])
if len(vowel_strings) == 0:
	print(-1)
for i in vowel_strings:
	print(i[:-1])


import re
m = re.findall('[AEIOUaeiou]{2,}(?=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])', input())
if m:
	print(*m, sep='\n')
else:
	print(-1)


import re
text = input()
S = list(map(lambda x: x.group(), re.finditer('(?<=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])[AEIOUaeiou]{2,}(?=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])', text)))
if len(S) != 0:
	for i in S:
		print(re.findall('[AEIOUaeiou]{2,}', i.strip())[0])
else:
	print(-1)


import re
theInput = input()
theResult = re.findall('(?=[^aeiouAEIOU]([aeiouAEIOU]{2,})[^aeiouAEIOU])', theInput)
if theResult != []:
	print('\n'.join(theResult))
else:
	print(-1)


import re
s = input()
s = re.sub('([^AEIOUaeiou])', '\\1\\1', s)
m = re.findall('[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm]([AEIOUaeiou]{2,})[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm]', s)
if len(m) == 0:
	print(-1)
else:
	print('\n'.join(m))


from re import findall
s = input().strip()
arr = list(findall('(?<=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])[AEIOUaeiou]{2,}(?=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])', s))
print(-1 if not arr else '\n'.join((a for a in arr)))


import re
s = input()
result = re.findall('(?<=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])([AEIOUaeiou]{2,})(?=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])', s)
if result:
	for i in result:
		print(i)
else:
	print(-1)


import re
vowels = 'AEIOUaeiou'
consonants = 'QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm'
substrings = re.findall('(?<=[' + consonants + '])[' + vowels + ']{2,}(?=[' + consonants + '])', input())
if substrings is not None:
	if len(substrings) > 0:
		for s in substrings:
			print(s)
	else:
		print(-1)
else:
	print(-1)


import re
g = re.findall('(?=((?i)[qwrtypsdfghjklzxcvbnm]((?i)[aeiou]{2,})(?i)[qwrtypsdfghjklzxcvbnm]))', input())
if g:
	print(*map(lambda x: x[1], g), sep='\n')
else:
	print('-1')


import re
v = 'aeiou'
c = 'QWRTYPSDFGHJKLZXCVBNM'
R = re.findall('(?<=[' + c + '])([' + v + ']{2,})(?=[' + c + '])', input().strip(), re.I)
if R == []:
	print(-1)
else:
	print(*R, sep='\n')


import re
consonants = 'QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm'
ss = re.findall('(?<=[' + consonants + '])([aeiouAEIOU]{2,})(?=[' + consonants + '])', input(), flags=re.I)
print('\n'.join(ss) if ss else -1)


import re
s = input()
matches = re.findall('(?<=[^aeiou])([aeiou]{2,})(?=[^aeiou])', s, flags=re.IGNORECASE)
if matches:
	for match in matches:
		print(match)
else:
	print('-1')


import re
line = str(input())
groups = re.findall('(?<=([QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm]))([AEIOUaeiou]{2,})(?=([QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm]))', line)
if len(groups) == 0:
	print('-1')
else:
	for group in groups:
		print(group[1])


import re
import sys
MATCH_REGEX = '[qwrtypsdfghjklzxcvbnm]([aeiou]{2,})(?=[qwrtypsdfghjklzxcvbnm])'
S = sys.stdin.readline().strip()
m = re.findall(MATCH_REGEX, S, re.IGNORECASE)
if m:
	print(*m, sep='\n')
else:
	print(-1)


import re
m = re.findall('(?<=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])([aeiouAEIOU]{2,})(?=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])', input().strip())
if not m:
	print(-1)
else:
	for x in m:
		print(x)


import re
reg = '([AEIOUaeiou]{2,})[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm]'
s = input().strip()
matches = re.findall(reg, s)
if matches:
	for m in matches:
		print(m)
else:
	print(-1)


from re import *
c = 'qwrtypsdfghjklzxcvbnm'
v = 'aeiou'
match = findall('(?<=[{%s}])([{%s}]{2,})(?=[{%s}])' % (c, v, c), input().strip(), flags=I)
print('\n'.join(match or ['-1']))


import re
n = input()
lst = []
cons = 'QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm'
ra = re.finditer('[aeiouAEIOU][aeiouAEIOU]+', n)
for i in ra:
	if i.start() == 0 or i.end() == len(n):
		pass
	elif n[i.start() - 1] in cons and n[i.end()] in cons:
		lst.append(i.group())
if len(lst) == 0:
	print(-1)
else:
	for i in lst:
		print(i)


import re
print('\n'.join(re.findall('(?<=[b-df-hj-np-tv-z])([aeiou]{2,})(?=[b-df-hj-np-tv-z])', input().strip(), flags=re.I) or ['-1']))


import re
m = re.findall('(?=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm]([AEIOUaeiou]{2,})[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])', input())
print(*m, sep='\n') if len(m) > 0 else print(-1)


import re
s = re.findall('(?=[^aeiou]([aeiou]{2,})[^aeiou])', input(), re.IGNORECASE)
if s:
	print('\n'.join(s))
else:
	print('-1')


import re
vowels = '[AEIOUaeiou]'
cons = '[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm]'
p = '(%s)(%s{2,})(?=%s)' % (cons, vowels, cons)
m = re.finditer(p, input())
result = list(map(lambda x: x.group(2), m))
if result:
	for s in result:
		print(s)
else:
	print(-1)


import re
consonants = 'QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm'
vowels = 'AEIOUaeiou'
match = re.findall('(?<=[' + consonants + '])([' + vowels + ']{2,})(?=[' + consonants + '])', input(), flags=re.I)
if match:
	print('\n'.join(match))
else:
	print(-1)


import re
z = ''.join([i * 2 for i in input()])
lst = [x.group(2) for x in re.finditer('([QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm]{1})([AEIOUaeiou]{4,})([QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm]{1})', z)]
if len(lst) > 0:
	for _ in lst:
		s = ''.join([_[i] for i in range(0, len(_), 2)])
		print(s)
else:
	print(-1)


import re
S = input()
m = re.findall('(?<=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])[AEIOUaeiou]{2,}(?=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])', S)
if m:
	for i in m:
		print(i)
else:
	print(-1)


import re
m = re.findall('(?<=[^aeiou])[aeiou]{2,}(?=[^aeiou])', input().strip(), flags=re.I)
if m:
	print('\n'.join(m))
else:
	print(-1)


import re
l = list(re.findall('[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm]([AEIOUaeiou]{2,})(?=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])', input()))
if len(l) > 0:
	print(*l, sep='\n')
else:
	print(-1)


import re
ret = re.findall('(?<=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])[aeiouAEIOU]{2,}(?=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])', input())
if len(ret) == 0:
	print(-1)
else:
	for word in ret:
		print(word)


import re
(consonants, s) = ('[qwrtypsdfghjklzxcvbnm]', input())
l = re.findall('(?<=' + consonants + ')([aeiou]{2,})(?=' + consonants + ')', s, flags=re.I)
if l:
	print(*l, sep='\n')
else:
	print(-1)


import re
str = input()
vowels = 'aeiouAEIOU'
found = False
sub_str = ''
if len(str) > 1:
	prev = None
	for char in str:
		if sub_str == '':
			if prev != None and (not prev in vowels) and (char in vowels):
				sub_str += char
		elif char in vowels:
			sub_str += char
		else:
			if len(sub_str) > 1:
				found = True
				print(sub_str)
			sub_str = ''
		prev = char
if not found:
	print('-1')


import re
m = re.findall('(?<=[qwrtypsdfghjklzxcvbnm])[aeiou]{2,}(?=[qwrtypsdfghjklzxcvbnm])', input(), re.IGNORECASE)
print('\n'.join(m or ['-1']))


import re
N = input()
L = re.findall('(?:[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])([AEIOUaeiou]{2,})(?=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])', N)
if L:
	print('\n'.join(L))
else:
	print(-1)


import re
S = input()
m = re.findall('(?<=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])[AEIOUaeiou]{2,}(?=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])', S)
if len(m) != 0:
	[print(x) for x in m]
else:
	print(-1)


import re
matches = re.findall('(?<=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])[AEIOUaeiou]{2,}(?=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])', input())
print('\n'.join(matches or ['-1']))


import re
m = re.finditer('[^AEIOUaeiou +\\-]([AEIOUaeiou]{2,})(?=[^AEIOUaeiou +\\-])', input().strip())
found = 0
for mm in m:
	print(mm.group(1))
	found = 1
if found == 0:
	print('-1')


import re
CONSONANTS = 'qwrtypsdfghjklzxcvbnmQWRTYPSDFGHJKLZXCVBNM'
test = re.compile('[aeoiu]{2,}', re.I)
s = input()
tmp = test.finditer(s)
output = ''
if tmp:
	for x in tmp:
		if x.start() > 0 and x.end() < len(s) and (s[x.start() - 1] in CONSONANTS) and (s[x.end()] in CONSONANTS):
			output += '\n' + x.group()
if output:
	print(output.lstrip())
else:
	print(-1)


import sys, re
string = str(input().strip())
m = re.findall('(?<=[qwrtypsdfghjklzxcvbnm])([aeiou]{2,})(?=[qwrtypsdfghjklzxcvbnm])', string, re.I)
if m == []:
	print(-1)
else:
	for item in m:
		print(item)


import re
S = input()
matches = re.findall('(?<=[qwrtypsdfghjklzxcvbnm])([aeiou]{2,})(?=[qwrtypsdfghjklzxcvbnm])', S, re.IGNORECASE)
if len(matches) == 0:
	print(-1)
else:
	for m in matches:
		print(m)


import re
line = input()
v = 'aeiou'
c = 'bcdfghjklmnpqrstvwxyz'
m = re.findall('(?<=[%s])([%s]{2,})[%s]' % (c, v, c), line, flags=re.I)
if m:
	for x in m:
		print(x)
else:
	print(-1)


import re
c = 'QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm'
v = 'AEIOUaeiou'
p = '[%s]+|[%s]{2,}|[\\+\\- ]+' % (c, v)
l = re.findall(p, input())
if all([x[0] not in v for x in l]):
	print(-1)
for (i, s) in enumerate(l):
	if i == 0 or i == len(l) - 1:
		continue
	if s and l[i - 1][0] in c and (s[0] in v) and (l[i + 1][0] in c):
		print(s)


import re
m = re.findall('(?=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm]([AEIOUaeiou]{2,})[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])', input())
if m != []:
	print('\n'.join(m))
else:
	print(-1)


import re
M = re.findall('(?<=[^aeiouAEIOU])([aeiouAEIOU]{2,})(?=[^aeiouAEIOU])', input())
if M:
	for i in M:
		print(i)
else:
	print(-1)


import re
a = re.findall('(?<=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])([aeiouAEIOU]{2,})(?=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])', input())
print('\n'.join(a) if a else -1)


import re
p = re.compile('[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm]([AEIOUaeiou]{2,})(?=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])')
m = p.findall(input())
if not m:
	print(-1)
else:
	for s in m:
		print(s)


import re
consonants = 'QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm'
vowels = 'AEIOUaeiou'
m = re.findall('(?<=[' + consonants + '])([' + vowels + ']{2,})(?=[' + consonants + '])', input())
if m:
	[print(x) for x in m]
else:
	print(-1)


import sys
import re

def find_vowels(s):
	p = '([QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])([AEIOUaeiou]{2,})([QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])'
	res = re.search(p, s)
	if not res:
		return -1
	print(res.group(2))
	start_pos = s.find(res.group(0))
	return s[start_pos + len(res.group(1)) + len(res.group(2)):]

def vn():
	s = sys.stdin.readline()
	s = find_vowels(s)
	if s == -1:
		print(-1)
	while s != -1:
		s = find_vowels(s)
	return

def main():
	vn()
	return
main()


import re
v = 'aeiouAEIOU'
c = 'QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm'
matches = re.findall('(?<=[%s])[%s]{2,}(?=[%s])' % (c, v, c), input())
print('\n'.join(matches or ['-1']))


import re
m = re.findall('(?<=[^aeiou0-9+-])[aeiou]{2,}(?=[^aeiou0-9+-])', input(), re.I)
print('\n'.join(m) if m else -1)


s = input()
import re
ptn = '(?<=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])[AEIOUaeiou]{2,}(?=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])'
print('\n'.join(re.findall(ptn, s) or ['-1']))


import re
c = 'qwrtypsdfghjklzxcvbnm'
v = 'aeiou'
m = re.findall('(?<=[%s])([%s]{2,})[%s]' % (c, v, c), input(), re.IGNORECASE)
print('\n'.join(m) if m else -1)


import re
c = 'QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm'
v = 'AEIOUaeiou'
r = '(?=[{0}]([{1}]{{2,}})[{0}])'.format(c, v)
t = re.findall(r, input())
if t:
	print(*t, sep='\n')
else:
	print(-1)


import re
st = re.findall('(?<=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])[AEIOUaeiou]{2,}(?=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])', input())
if st:
	print('\n'.join((i for i in st)))
else:
	print(-1)