#C11183. Matrix Transpose

    ID: 40471 Type: Default 1000ms 256MiB

Matrix Transpose

Matrix Transpose

You are given an \(n \times m\) matrix. Your task is to compute the transpose of the matrix.

The transpose of a matrix is formed by turning all the rows of the original matrix into columns and vice versa. More formally, if the given matrix is represented as \(A\) where \(A_{ij}\) is the element in the \(i\)-th row and \(j\)-th column, then the transposed matrix \(B\) is given by \(B_{ji} = A_{ij}\).

Input is read from standard input (stdin) and output is written to standard output (stdout).

inputFormat

The first line of input contains two integers \(n\) and \(m\), representing the number of rows and columns of the matrix respectively. The following \(n\) lines each contain \(m\) space-separated integers, representing the elements of the matrix.

outputFormat

Output the transposed matrix. The transposed matrix will have \(m\) rows and \(n\) columns. Each row should contain \(n\) space-separated integers.

## sample
2 2
1 2
3 4
1 3

2 4

</p>