#C12370. Matrix Transposition

    ID: 41790 Type: Default 1000ms 256MiB

Matrix Transposition

Matrix Transposition

You are given a matrix \(A\) of dimensions \(R \times C\). Your task is to compute its transpose \(A^T\), where the element at the \(i^{th}\) row and \(j^{th}\) column of \(A^T\) is equal to the element at the \(j^{th}\) row and \(i^{th}\) column of \(A\).

Note: Do not use any built-in library functions or language features that directly perform matrix transposition.

For example, given the matrix:

[ A = \begin{bmatrix} 1 & 2 & 3 \ 4 & 5 & 6 \end{bmatrix} ]

The transposed matrix is:

[ A^T = \begin{bmatrix} 1 & 4 \ 2 & 5 \ 3 & 6 \end{bmatrix} ]

</p>

inputFormat

The first line contains two integers (R) and (C) (the number of rows and columns respectively). Each of the following (R) lines contains (C) space-separated integers representing the elements of the matrix.

outputFormat

Output the transposed matrix. Each row of the transposed matrix should be printed on a new line with its elements separated by a single space.## sample

2 3
1 2 3
4 5 6
1 4

2 5 3 6

</p>