#K73002. Matrix Transposition
Matrix Transposition
Matrix Transposition
Given an \( n \times m \) matrix \( A \), compute its transpose \( A^T \). In other words, the rows of \( A \) become the columns of \( A^T \) and vice versa. Formally, \( A^T_{ij} = A_{ji} \) for every valid index.
For example, the transpose of \[ \begin{bmatrix}1 & 2\\3 & 4\\5 & 6 \end{bmatrix} \] is \[ \begin{bmatrix}1 & 3 & 5\\2 & 4 & 6 \end{bmatrix} \]
inputFormat
The first line contains two space-separated integers, n and m, representing the number of rows and columns respectively. The next n lines each contain m space-separated integers representing the matrix A.
outputFormat
Output the transposed matrix. Each line represents a row of the transposed matrix with its elements separated by a single space.## sample
3 2
1 2
3 4
5 6
1 3 5
2 4 6
</p>