Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Bird Language by marcelina.gorzelana
vowels = "aeiouy"
def translate(phr):
res = ""
cons = False
i = 0
while i < len(phr):
cons = False
if i < len(phr) and vowels.find(phr[i]) == -1:
res+= phr[i]
cons = True
if phr[i] == ' ':
i+= 1
else:
i+= 2
if i >= len(phr):
break
if vowels.find(phr[i]) > -1 and cons == False:
res+= phr[i]
i+= 3
return res
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert translate("hieeelalaooo") == "hello", "Hi!"
assert translate("hoooowe yyyooouuu duoooiiine") == "how you doin", "Joey?"
assert translate("aaa bo cy da eee fe") == "a b c d e f", "Alphabet"
assert translate("sooooso aaaaaaaaa") == "sos aaa", "Mayday, mayday"
Nov. 22, 2016