Question 2 - Transpose and Flatten
Task
You are given an NxM integer array matrix with space-separated elements (N= rows and M= columns).
The question is to print the transpose and flatten the results.
Input Format
The first line contains the space-separated values of N and M.
The next N lines contain the space-separated elements of M columns.