Company: Flipkart Grid SDEintern_19july
Difficulty: medium
Akash has recently bought a puzzle book. Each page in the book has a word puzzle in which a grid of letters from the English alphabet (uppercase or lowercase) or digits between 0 and 9 is given. Akash has to figure out the number of occurrences of a particular word in the given grid. The grid is always a square, and the word can be present in any direction in the grid, i.e., left to right, right to left, top to bottom, bottom to top, and the four diagonal directions. Palindrome words (which read the same as the original word from the reverse direction too), if present in the grid, will be counted twice. An occurrence is a set of |word| consecutive cells that all lie inside the grid, are visited by taking equal steps in one fixed direction, and spell the word exactly. Matching is case sensitive : a and A are different characters. Write a program to help Akash. Read the input from STDIN and print the output to STDOUT. Do not print arbitrary strings anywhere in the program, as these contr