Thursday, August 26, 2021

US city, cardinal number, ordinal number (Solution)

Ready to solve this week's Sunday Puzzle from NPR? Spoiler alert---I'll reveal my solution at the end of this post. Here's the puzzle again:


This week's challenge comes from listener Ben Austin, of Dobbs Ferry, N.Y. Take the name of a major American city. Move one of its letters three spaces later in the alphabet. Embedded in the resulting string of letters, reading left to right, is a cardinal number. Remove that number, and the remaining letters, reading left to right, spell an ordinal number. What city is it, and what are the numbers?

In my preview post, I spelled out the basic approach I'd use: iterate through city names, iterate through their letters, shifting each letter forward alphabetically three places; iterate through cardinal numbers ("one" through "one hundred") and see if it's embedded in the "shifted" city; if so, remove it and see if the remaining string is in our list of ordinal numbers. Pretty straightforward.

Well, I assembled the necessary lists and implemented my approach in a solver script, and it worked like a charm. I found and used a CSV of the 1,000 biggest cities in the USA, which you can download here. I uploaded the rest to the GitHub for this puzzle blog: cardinal numbers list, ordinal numbers list, and the solver script.

How about you? Did you solve this one?

Okay, spoilers ahead! Keep scrolling to see my answer:
































SOLUTION: 'Fort Worth' --> 'foutworth', which contains 'two'; removing 'two' yields 'fourth'

No comments:

Post a Comment

Director, anagram, film award

Welcome back to Natural Language Puzzling, the blog where we use natural language processing and linguistics to solve the Sunday Puzzle from...