Rhyme Time

Published by Helen Yu in

Write a function that returns true if two lines rhyme and false otherwise. For the purposes of this exercise, two lines rhyme if the last word from each sentence contains the same vowels.

Examples

does_rhyme("Sam I am!", "Green eggs and ham.") ➞ true

does_rhyme("Sam I am!", "Green eggs and HAM.") ➞ true
# Capitalization and punctuation should not matter.

does_rhyme("You are off to the races", "a splendid day.") ➞ false

does_rhyme("and frequently do?", "you gotta move.") ➞ false

Notes

  • Case insensitive.
  • Here we are disregarding cases like "thyme" and "lime".
  • We are also disregarding cases like "away" and "today" (which technically rhyme, even though they contain different vowels).
Watch a quick demo on how Edabit works.