License Plate Game

Find words containing three letters in order, a road trip game solved

Screenshot of License Plate Game
License Plate Game.

There's a road trip game where you look at the three letters on a license plate and try to think of a word that contains all three letters in that order, but not necessarily adjacent. You see "BRN" and someone shouts "BURNING." You see "PLT" and there's "PLATFORM." It's a good game because the difficulty varies wildly. Some letter combos have dozens of common answers. Others seem impossible until someone finds the one obscure word that works.

California license plate
A California license plate. The License Plate Game challenges you to find words containing the plate's letters in order. Wikimedia Commons

I built this to settle arguments. You type three letters and it instantly shows you the shortest words that contain those letters as a subsequence.

The matching algorithm

The app loads a word list from a text file on startup. When you enter three letters, it runs every word through a subsequence check. The algorithm walks through the word character by character, looking for each of the three target letters in order. It maintains a position pointer that advances through the word. For each target letter, it searches forward from the current position. If it finds all three before running out of word, it's a match. If any letter is missing or appears out of order, the word is rejected.

This is an O(n) scan per word, where n is the word length, and it runs across the entire dictionary on every keystroke. With a typical English word list in the range of 100,000-200,000 words, the filtering completes in a few milliseconds on any modern browser. No indexing or precomputation needed.

Map of US license plate serial formats by state
US license plate serial formats by state. Wikimedia Commons

Result ordering

The results are sorted by word length, shortest first, and capped at ten. This was a deliberate choice. In the actual road trip game, shorter words are more impressive answers because the letters are packed tighter. Nobody is impressed when you find a 14-letter word; the letters are bound to show up somewhere in something that long. Finding a 4-letter word that contains "XPL" is the kind of answer that wins the round.

Implementation

The input field auto-capitalizes and strips non-alphabetic characters. A hint below the field shows how many more letters you need to enter. Once you hit three letters, results appear instantly below a divider line. The whole UI fits in a white card on a gray background. It's responsive down to about 480px, which is the size that matters since you're usually playing this on a phone in the passenger seat.

The project is two files: one HTML page and one word list. Everything runs client-side.