(You can close this window)
This session will automatically time-out after 5 minutes and can no longer be accessed, start immediately.
java
Transpose the given matrix.
Input
The first line of input contains two numbers m and n (1 ≤ m, n ≤ 200) corresponding to the number of rows and the number columns of the matrix respectively. It is then followed by m rows with n numbers in each column.
Output
The output should contain a transposed matrix.
Example
Input:
4 3
1 2 5
4 3 3
3 4 9
8 7 7
Output:
1 4 3 8
2 3 4 7
5 3 9 7