Re.findall() & Re.finditer()

  • + 0 comments

    import re

    S = input()

    vowels = 'AEIOUaeiou' consonants = 'QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm'

    pattern = fr"(?<=[{consonants}])([{vowels}]{{2,}})(?=[{consonants}])"

    matches = re.findall(pattern, S)

    if matches: for x in matches: print(x) else: print(-1)