# BackStory

Given a square matrix of alphabets which contain English letters in arbitrary manner. While searching a word in it, you can go left to right horizontally, vertically downwards or diagonally towards left (both upwards and downwards).

You have to find the number of matches of a given word in the matrix.

For example, In the given square matrix {A#A#K,A#S#K,A#K#K},

The word "ASK" is matched four times in the input matrix. So the output will be 4.

# Input Format

You will be given two-dimensional string array and a string(Word to be searched) as arguments.

# Output Format

You need to return the Number of occurrences of the word in the matrix {an integer}.

# Sample Test Case1

Sample Input

2
2
A S
S T

AS


2

# Sample Test Case 2

Sample Input
5
5
E D E E E
D I S K E
E S E E E
E C E E E
E E E E E

DISK


1

# Explanation:

In this example, "DISK" is matched only one time in the input matrix. So the output will be 1.

## Winning

Shortest code in bytes wins.

• Closely related, but not quite a duplicate. – AdmBorkBork Jul 31 '17 at 15:03
• You will be given a function which contains -> what does that mean? Would getting input in a different format be acceptable? – Stephen Jul 31 '17 at 15:03
• Yep... @Arnauld – Mickey Jack Jul 31 '17 at 15:05
• The input format is specified clearly.@StepHen – Mickey Jack Jul 31 '17 at 15:09
• This appears to be copied from elsewhere, without attribution. I'll put this on hold until you add one. – Dennis Jul 31 '17 at 15:32