Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Speedy category for Bird Language by SteveHill
import re
#VOWELS = "aeiouy"
def translate(phrase):
phr1 = re.sub('(?<=[^aeiouy\s])[aeiouy]', '', phrase) #(la or le ⇒ l)
phr2 = re.sub(r'([aeiouy])\1\1', r'\1', phr1) #(aaa ⇒ a)
return phr2
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"
Sept. 14, 2016
Comments: