#C6008. Matrix Rotation
Matrix Rotation
Matrix Rotation
You are given an \( n \times n \) matrix of integers. Your task is to rotate the matrix by 90° clockwise. For a given matrix \( A \), the rotated matrix \( B \) is defined as:
\[ B_{i,j} = A_{n-1-j, i} \]
The input will be read from standard input and the rotated matrix should be printed to standard output with each row on a new line and numbers separated by a single space.
Example:
Input: 3 1 2 3 4 5 6 7 8 9</p>Output: 7 4 1 8 5 2 9 6 3
inputFormat
The first line of input contains an integer \( n \) representing the number of rows (and columns) of the square matrix. Each of the following \( n \) lines contains \( n \) space-separated integers representing the matrix rows.
outputFormat
Print the rotated matrix, with each row on a new line and values separated by a single space.
## sample3
1 2 3
4 5 6
7 8 9
7 4 1
8 5 2
9 6 3
</p>