Transpose

5

3 votes
Very-Easy
Problem

Given a 2D array A, your task is to convert all rows to columns and columns to rows.

Input:
First line contains 2 space separated integers, N - total rows, M - total columns.
Each of the next N lines will contain M space separated integers.

Output:
Print M lines each containing N space separated integers.

Constraints:
1N10
1M10
0A[i][j]100 where 1iN and 1jM

Time Limit: 5
Memory Limit: 256
Source Limit:
Editor Image

?