Company: Mastercard_2ndaug_2
Difficulty: medium
Akash and the Puzzle Book Akash bought a puzzle book. Every page holds a word search: a square grid of N rows and N columns, each cell holding one English letter (uppercase or lowercase) or one digit 0 – 9 . A word occurs in the grid whenever its characters appear in consecutive cells along a straight line in one of the eight directions: left to right, and right to left, top to bottom, and bottom to top, and the four diagonals (down-right, up-left, down-left, up-right). Count every occurrence separately. Two occurrences that share cells still count as two — the same starting cell may even begin several occurrences, one per direction. A consequence worth stating plainly: a palindromic word that sits on some line is found twice there, once reading the line one way and once reading it the other way. Matching is case sensitive : A and a are different characters. Given the grid and a word, report how many occurrences the word has. Input Format The first line contains the integer N , the sid