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.
importsys,reVOWELS,CONSONANTS="aeiou","qwrtypsdfghjklzxcvbnm"S=sys.stdin.read()match_iter=re.finditer(rf"(?<=[{CONSONANTS}])[{VOWELS}][{VOWELS}]+(?=[{CONSONANTS}])",S,flags=re.I)first_match=next(match_iter,None)#Check if iterator is emptyiffirst_match:print(first_match.group())formatchinmatch_iter:print(match.group(),sep='\n')else:print('-1')
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Re.findall() & Re.finditer()
You are viewing a single comment's thread. Return to all comments →