Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Using regex solution in Clear category for Bird Language by dbirmajer
import re
def translate(text: str) -> str:
output = re.sub(r"([aeiouy])\1{2}|", r"\1", text)
output = re.sub(r"([^aeiouy ])[aeiouy]", r"\1", output)
return output
if __name__ == "__main__":
print("Example:")
print(translate("hieeelalaooo"))
# These "asserts" are used for self-checking and not for an auto-testing
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("Coding complete? Click 'Check' to earn cool rewards!")
Sept. 2, 2021