Solve unique string 1.3

Not quite the low-level approach found in the book but similar.