Matrix Transpose
Given a matrix A of size N x M, compute and print its transpose, A^T. The transpose of a matrix is obtained by flipping the matrix over its main diagonal, switching the row and column indices of the matrix. That is, the element at A[i][j] will be at A^T[j][i].
Input
The first line contains two integers N and M (1 <= N, M <= 1000), the dimensions of the matrix. The next N lines each contain M integers, representing the elements of the matrix.
Output
Print N lines, each containing M integers, representing the transpose of the input matrix. The elements in each row should be separated by spaces.
Constraints
1 <= N, M <= 1000. The values of matrix elements are integers between -1000 and 1000.
Example 1
2 3 1 2 3 4 5 6
1 4 2 5 3 6
A 2x3 matrix transposed becomes a 3x2 matrix.
Example 2
3 2 10 20 30 40 50 60
10 30 50 20 40 60
A 3x2 matrix transposed becomes a 2x3 matrix.
Hints
# Read the input from stdin and print the answer.
import sys
def main():
data = sys.stdin.read().split()
# your code here
main()
2 3 1 2 3 4 5 6
3 2 10 20 30 40 50 60