Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Creative category for Bird Language by mohamedsleymi2016
def translate(phrase):
v='aeoiuy'
phrase=[(phrase := phrase.replace('{}{}{}'.format(i,i,i),i)) for i in v][-1]
x =([(j :=0 )] + [(c+str((j := j+1)))[0] if ((c not in v) or (phrase[j-1] in v)or(phrase[j-1]==' ')) else ('$'+str((j := j+1)))[0] for c in phrase ])[1:]
return ''.join([i for i in x if i!='$'])
if __name__ == '__main__':
print("Example:")
print(translate("hieeelalaooo"))
#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"
print("Coding complete? Click 'Check' to review your tests and earn cool rewards!")
Dec. 14, 2020