Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
my solution solution in Clear category for Bird Language by defensor
import re
def translate(text):
# My solution
# 1. remove the random vowel which comes right after each consonant letter (=pick only the consonant letter)
# 2. remove the extra 2 repeated vowels (=pick only the first vowel)
first = re.sub('([^aeiouy\s][aeiouy])', lambda m:m.group(0)[0], text) #1
second = re.sub('(a{3}|e{3}|i{3}|o{3}|u{3}|y{3})', lambda m:m.group(0)[0], first) #2
return second
if __name__ == '__main__':
print("Example:")
print(translate('sooooso aaaaaaaaa'))
# 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!")
July 25, 2021