We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Re.findall() & Re.finditer()
Re.findall() & Re.finditer()
Sort by
recency
|
371 Discussions
|
Please Login in order to post a comment
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)
import re
pattern = re.compile(r"(?<=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])[AEIOUaeiou]{2,}(?=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])")
for x in re.findall(pattern, input()) or [-1]: print(x)
import re partten = r'(?<=[bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ])([aeiouAEIOU]{2,})(?=[bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ])' m = list(map(lambda x:x.group(),re.finditer(partten,input()))) if m: for i in m: print(i) else: print(-1)