#K50927. Matrix Transposition

    ID: 28973 Type: Default 1000ms 256MiB

Matrix Transposition

Matrix Transposition

In this problem, you are given a matrix and asked to compute its transpose. Given a matrix (A) of size (m \times n), the transpose of the matrix, denoted by (A^T), is an (n \times m) matrix defined by the formula:

AijT=AjiA^T_{ij} = A_{ji}

You will be provided with the dimensions of the matrix and its elements via standard input. Your task is to output the transposed matrix in the specified format.

inputFormat

The first line of input contains two integers (m) and (n), representing the number of rows and columns of the matrix respectively. This is followed by (m) lines, each consisting of (n) space-separated integers denoting the elements of the matrix.

outputFormat

Output the transposed matrix which will have (n) rows and (m) columns. Each line should contain (m) space-separated integers corresponding to a row of the transposed matrix.## sample

2 2
1 2
3 4
1 3

2 4

</p>