Consider the word "near". If you shift the each of its consonants to the next consonant of the alphabet, and each of its vowels to the next vowel in the alphabet, you get the word "pies".
Determine the one-word title of a famous novel (also made into a film) that if you shift its consonants and vowels in the same manner gives you another one-word title of a famous novel that was also made into a film.
What novels and films are these?
*** Adapted from a problem appearing in NPR's Sunday Puzzle in 2007.
Coma Dune
---------------------
cons = 'bcdfghjklmnpqrstvwxyz'
vows = 'aeiou'
for w in words:
other = ''
for c in w:
if c in cons:
d = cons[(cons.index(c) + 1)%21]
elif c in vows:
d = vows[(vows.index(c) + 1)%5]
other += d
if other in words:
print(w,other))
|
Posted by Larry
on 2023-11-18 12:55:02 |