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
|
373 Discussions
|
Please Login in order to post a comment
Here is HackerRank Re.findall() & Re.finditer() in python solution - https://programmingoneonone.com/hackerrank-re-findall-re-finditer-solution-in-python.html
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)