Ugly solution to problem 017, which is sensitive to spellings