#C8580. Matrix Rotation
Matrix Rotation
Matrix Rotation
Given an \(n \times n\) matrix, your task is to rotate the matrix 90° clockwise in-place. The rotation can be described by the formula:
\(B[i][j] = A[n-1-j][i]\)
You are required to read the matrix from the standard input and output the rotated matrix to the standard output. Each row of the matrix should be printed on a separate line with space-separated integers.
inputFormat
The first line of input contains a single integer \(n\) representing the size of the matrix. The next \(n\) lines each contain \(n\) space- separated integers representing the matrix rows.
outputFormat
Output the rotated matrix in \(n\) lines. Each line should contain \(n\) space-separated integers.
## sample3
1 2 3
4 5 6
7 8 9
7 4 1
8 5 2
9 6 3
</p>