Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Bird Language by Kamil0320
VOWELS = "aeiouy"
def three(list, ind):
if (list[ind]==list[ind+1]==list[ind+2]):
return True
return False
def translate(phrase):
t=list(phrase)
i=0
res=[]
while True:
if t[i]==' ':
res.append(t[i])
i+=1
elif t[i] not in VOWELS and t[i+1] in VOWELS:
res.append(t[i])
i+=2
elif (t[i] in VOWELS) and three(t,i):
res.append(t[i])
i+=3
if i>=len(phrase):
break
return "".join(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"
Oct. 29, 2016