Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Bird Language by Julia_Swiatek
def translation(text: str) -> str:
# your code here
return ""
import re, functools
translation = functools.partial(re.sub,r"(\w)(\1\1|.)",r"\1")
def translate(phrase):
vowels = "aeiouy"
result = ""
i = 0
while i < len(phrase):
if phrase[i] == ' ':
result += ' '
i += 1
continue
result += phrase[i]
if phrase[i] in vowels:
i += 3
elif phrase[i] not in vowels:
i += 2
return result
print("Example:")
print(translation("hieeelalaooo"))
# These "asserts" are used for self-checking
assert translation("hieeelalaooo") == "hello"
assert translation("hoooowe yyyooouuu duoooiiine") == "how you doin"
assert translation("aaa bo cy da eee fe") == "a b c d e f"
assert translation("sooooso aaaaaaaaa") == "sos aaa"
print("The mission is done! Click 'Check Solution' to earn rewards!")
Jan. 18, 2024