Ivo, a renowned competitor, felt nostalgic about his training with the classic UVa Online Judge and decided to incorporate it into a word search game.
The game is simple: given a matrix of letters, Ivo searches for occurrences of the letter sequence U-V-A, which can occur vertically, horizontally, or diagonally. Create a program that tells how many times Ivo saw the UVa!
The first line presents the dimensions $$$N$$$ and $$$M$$$ of the matrix $$$(3 \leq N, M \leq 100)$$$, separated by a space. The following $$$M$$$ lines each contain $$$N$$$ letters.
Output the number of occurrences of the letter sequence UVa identified by Ivo.
3 3IVOVIUUVA
1
4 5aaaavvvvuuuuvvvvaaaa
16
In the second example, each 'v' has an adjacent 'u' and 'a' vertically, defining $$$8$$$ occurrences of 'UVa'. Additionally, each of the 4 'v's that are not on the edges of the matrix has an occurrence of 'UVa' in each diagonal, resulting in $$$8$$$ more cases for a total of $$$16$$$.