#K64727. Matrix Transposition

    ID: 32040 Type: Default 1000ms 256MiB

Matrix Transposition

Matrix Transposition

Given a matrix, compute its transpose. The transpose of a matrix \(A\), denoted as \(A^T\), is defined such that \(A^T[i][j] = A[j][i]\). The matrix may be square or rectangular, and it can even have a single row or a single column.

The input is read from stdin and the output must be printed to stdout. Ensure that you handle matrices with zero columns correctly.

inputFormat

The first line contains two space-separated integers \(R\) and \(C\), representing the number of rows and columns of the matrix, respectively. Then \(R\) lines follow, each containing \(C\) space-separated integers. If \(C = 0\), then the row is empty which represents an empty matrix.

outputFormat

Output the transpose of the given matrix. For each row of the transposed matrix, print the elements separated by a space on a new line. If the transposed matrix is empty, print nothing.

## sample
2 2
1 2
3 4
1 3

2 4

</p>