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
|
381 Discussions
|
Please Login in order to post a comment
import re pattern= r"(?<=[^AEIOUaeiou])([AEIOUaeiou]{2,})(?=[^AEIOUaeiou])"
S = re.findall(pattern, input())
if S: print(*S, sep="\n")
else: print(-1)
import re
pattern= r"(?<=[^AEIOUaeiou])([AEIOUaeiou]{2,})(?=[^AEIOUaeiou])" S = list(re.finditer(pattern, input()))
if S: for i in S: print(i.group())
else: print(-1)
In case you are having issues like me to check if the iterator it's empty with the solutions here: