Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Bird Language by Lachesis_132296
VOWELS = "aeiouy"
def aaa(word, index = 0):
n = len(word)
word2 = word[:]
if n == 1:
return word
for j in range(index, n):
if word[j] in VOWELS:
word2 = word[:j+1] + word[j+3:]
return aaa(word2, j+1)
else:
word2 = word[:j+1] + word[j+2:]
return aaa(word2, j+1)
return word2
def translation(phrase):
result = ""
for i in phrase.split():
result = result + aaa(i) + " "
result = result[:len(result)-1]
return result
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert translation("hieeelalaooo") == "hello", "Hi!"
assert translation("hoooowe yyyooouuu duoooiiine") == "how you doin", "Joey?"
assert translation("aaa bo cy da eee fe") == "a b c d e f", "Alphabet"
assert translation("sooooso aaaaaaaaa") == "sos aaa", "Mayday, mayday"
Nov. 19, 2016