Input Format
A single line of input containing string .
Constraints
Output Format
Print the matched substrings in their order of occurrence on separate lines.
If no match is found, print -1.

hackerrank re findall and re finditer problem solution in python

Problem solution in Python 3 programming language.

import re
consonants = 'qwrtypsdfghjklzxcvbnm'
vowels = 'aeiou'
match = re.findall(r'(?<=['+consonants+'])(['+vowels+']{2,})(?=['+consonants+'])', input(),flags = re.I)
if match:
    for i in match:
        print(i)
else:
    print(-1)

Second solution

# Enter your code here. Read input from STDIN. Print output to STDOUT
import re
v = "aeiou"
c = "qwrtypsdfghjklzxcvbnm"
m = re.findall(r"(?<=[%s])([%s]{2,})[%s]" % (c, v, c), input(), flags = re.I)
print('\n'.join(m or ['-1']))

Problem solution in Python 2 programming language.

import re
consonants = 'qwrtypsdfghjklzxcvbnm'
vowels = 'aeiou'
match = re.findall(r'(?<=['+consonants+'])(['+vowels+']{2,})(?=['+consonants+'])',raw_input(),flags = re.I)
if match:
    for i in match:
        print i
else:
    print -1