Problem list
Log in
#r03093 · Online Judge > GoldOJ

Transpose a Matrix

Bronze II 2.0 s 1024 MB

An $n \times m$ matrix is given. Print its transpose (an $m \times n$ matrix), rows on separate lines, values space-separated.

Input

Line 1: $n$ $m$. Next $n$ lines: the matrix ($1 \le n, m \le 10$).

Output

Print the transposed matrix.

Example 1

Input
2 3
1 2 3
4 5 6
Output
1 4
2 5
3 6
Source
Online Judge > GoldOJ
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code