Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Bird Language by imloafer
from itertools import starmap, groupby
def translate(text: str) -> str:
# your code here
translation = ''
for word in text.split():
translation += ''.join(x for x in starmap(lambda x, g: x * (len(list(g))//3) if x in 'aoeiuy' else x, groupby(word))) + ' '
return translation.strip()
print("Example:")
print(translate("hieeelalaooo"))
assert translate("hieeelalaooo") == "hello"
assert translate("hoooowe yyyooouuu duoooiiine") == "how you doin"
assert translate("aaa bo cy da eee fe") == "a b c d e f"
assert translate("sooooso aaaaaaaaa") == "sos aaa"
print("The mission is done! Click 'Check Solution' to earn rewards!")
Oct. 6, 2022
Comments: