#C8847. Matrix Rotation
Matrix Rotation
Matrix Rotation
Given an N × N matrix, your task is to rotate the matrix by 90° clockwise. This transformation is defined as: For each element at position \( (i, j) \) in the original matrix, its new position becomes \( (j, N-1-i) \). The rotated matrix should be printed with rows on separate lines, and elements within a row separated by a space.
Example:
Input: 3 1 2 3 4 5 6 7 8 9</p>Output: 7 4 1 8 5 2 9 6 3
You are required to read the input from stdin and write the output to stdout.
inputFormat
The input begins with a single integer N (1 ≤ N ≤ 100) denoting the size of the matrix. Following this, there are N lines, each containing N space-separated integers representing the matrix.
outputFormat
Output the rotated matrix. Each row should be printed on a new line, with each element 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>