Happy New Year for 2021
Statement
Goal
This is the year 2021.In this fun search you will be presented with a grid of numerals comprising only of 0 1 2 from the digits of the year. Each row will be the same length within a test.
Output the total number of '2021's you can find forward, backward, down, and up.
In the example, '2021' appears in the grid 2 times in the up and down directions but is too short to appear forward or backward.
Input
Line 1: An integer N for the number of rows
Next N rows: of input containing the characters 0 1 2 without spaces. ROW lengths are the same within a test.
Next N rows: of input containing the characters 0 1 2 without spaces. ROW lengths are the same within a test.
Output
Line 1 : Total count of the '2021's you can find in the grid, forward backward, down and up.
Constraints
1 ≤ N ≤ 100
1 ≤ ROW length ≤ 30
1 ≤ ROW length ≤ 30
Example
Input
4 21 02 20 12
Output
2
Game modes
Fastest, Shortest
Test cases
Down and up in order Test
Input
4
21
02
20
12
Output
2
Validator 1 Validator
Input
1
20212021
Output
3
Each way Test
Input
4
20212021
02120212
21202120
12021202
Output
14
Validator 2 Validator
Input
4
202120212021
021202120212
212021202120
120212021202
Output
24
Mixed up Test
Input
4
0212021202
2012021020
2102012012
1020212021
Output
9
Validator 3 Validator
Input
4
120120210210
021202012012
201202102102
021201210201
Output
5
So mixed up Test
Input
6
202102021201202012022102
021202012020120210201201
201201202101201202120210
201221020120221020120120
201201201201201222101021
012001201201201021012012
Output
16
Validator 4 Validator
Input
7
201202102102120210212021
021020120210221010210120
201202210120120012012201
102101201022102012012010
020120201020210201201201
201202010201020120120210
120120102012010201202121
Output
20
Something amiss Test
Input
2
2020012002
1020021021
Output
0
Validator 5 Validator
Input
4
21
02
10
22
Output
1
One long row Test
Input
1
201201201201201202012201020212
Output
2
Validator 6 Validator
Input
1
120212010201202012012020112012
Output
4
One big column Test
Input
100
1
2
0
2
0
1
2
0
2
1
2
0
1
2
0
2
1
0
2
0
2
1
2
1
2
1
2
0
2
1
0
1
2
0
2
1
0
2
2
0
2
1
0
1
2
0
2
1
0
2
1
0
2
1
0
2
0
2
1
2
0
2
0
2
1
0
2
1
0
2
0
2
1
0
2
1
0
2
1
0
2
0
2
1
2
0
2
1
2
0
2
1
2
1
2
1
0
2
0
2
Output
22
Validator 7 Validator
Input
100
1
2
0
2
0
1
2
0
2
1
2
0
1
2
0
2
1
0
2
0
2
0
2
1
2
1
2
0
2
1
0
1
2
0
2
1
0
2
2
0
2
1
0
1
2
0
2
1
0
2
1
0
2
1
0
2
0
2
1
2
0
2
0
2
1
0
2
1
0
2
0
2
2
1
2
1
0
2
1
0
2
0
2
1
2
0
2
1
2
0
2
1
2
1
2
1
0
2
0
2
Output
21
Solution language
Solution
Stub generator input