#C261. Matrix Transposition

    ID: 45945 Type: Default 1000ms 256MiB

Matrix Transposition

Matrix Transposition

You are given a matrix with dimensions (n \times m) where (n) is the number of rows and (m) is the number of columns. Your task is to compute the transpose of the matrix. The transpose of a matrix (A), denoted as (A^T), is defined as [ A^T_{ij} = A_{ji} ] for all valid indices (i) and (j).

For example, if (A) is a (2 \times 3) matrix:
1 2 3
4 5 6

then its transpose is a (3 \times 2) matrix:
1 4
2 5
3 6

Input is provided via standard input and output should be written to standard output.

inputFormat

The first line contains two integers (n) and (m) ((1 \le n, m \le 100)), representing the number of rows and columns respectively. This is followed by (n) lines, each containing (m) integers separated by spaces, which represent the elements of the matrix.

outputFormat

Output the transpose of the matrix. The output should consist of (m) lines, each containing (n) integers separated by a single space.## sample

2 2
1 2
3 4
1 3

2 4

</p>