A puzzle is a 5 x 5 grid with one uppercase letter in each cell. The task is to find dictionary words in that grid.
A word is traced by starting at any cell and repeatedly stepping to one of the eight adjacent cells, reading the letters in the order the cells are visited. No cell may be visited more than once.
Z C C D X
K Q M N B
U O W Z Y
F C O I J
P A Q Z T
In the puzzle above CAP, COW and COOK can be traced, while COD and PACK cannot.
Given the puzzle and the dictionary, count the dictionary words that can be traced in the puzzle.