Solution for letter locks puzzle

Here's some code and commentary about the letter locks puzzle. Not the sweetest code I've ever written, but it seems to do the job.