Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Bird Language by MedykMatyk
VOWELS = "aeiouy"
def translation(phrase):
result = phrase[0]
last = phrase[0]
last3 = ''
counter = 0
for i in range(1,len(phrase)):
if(i>3):
if(phrase[i-4] in VOWELS):
if(counter >= 3):
last3 = phrase[i-3]+phrase[i-2]+phrase[i-1]
now = phrase[i]
now = now*3
else:
last3=' '
if(phrase[i]!=last or last not in VOWELS or last==' ' or last3==phrase[i]*3):
if(phrase[i-1] in VOWELS or phrase[i-1]==' ' or last3==phrase[i]*3):
result+=phrase[i]
last = phrase[i]
if(counter >= 3 and last3==phrase[i]*3):
counter = 0
counter+=1
print("Result: " + result)
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, 2017