The input is an N by N matrix and the output is a new (N-2) by (N-2) matrix. Each element of the new matrix corresponds to the maximum value in each 3 by 3 region of the original matrix.
For example, if the original matrix is
10 20 30 90 30
50 60 30 20 50
80 50 70 60 20
90 40 30 20 80
20 30 40 50 90
then the new matrix will be
80 90 90
90 70 80
90 70 90
The first number is the matrix size N, where 3 <= N <= 10.
The following N*N numbers are the elements of the N by N matrix.
The elements are all positive integers, ranging from 1 to 99.
A new (N-2) by (N-2) matrix
Use “%3d” to print each element and add a newline at the end of each row.
You need to print a newline character at the end of each line. ('\n')