#C1160. Matrix 90-Degree Counterclockwise Rotation
Matrix 90-Degree Counterclockwise Rotation
Matrix 90-Degree Counterclockwise Rotation
Given an \(N \times N\) matrix \(A\), rotate it by 90 degrees counterclockwise. The rotated matrix \(B\) is defined by the formula:
\[ B_{i,j} = A_{j, N-1-i} \]
Your task is to read the matrix from standard input and output the rotated matrix to standard output.
Example:
Input: 3 1 2 3 4 5 6 7 8 9</p>Output: 3 6 9 2 5 8 1 4 7
inputFormat
The first line contains an integer \(N\) (the dimension of the matrix). The following \(N\) lines each contain \(N\) space-separated integers representing the matrix \(A\).
outputFormat
Print the rotated matrix \(B\) with \(N\) lines. Each line should contain \(N\) space-separated integers corresponding to a row of the rotated matrix.
## sample3
1 2 3
4 5 6
7 8 9
3 6 9
2 5 8
1 4 7
</p>