convert rows into columns

Hi guys

Could anyone advise me how to convert my rows into columns from a file

My file would be similar to this:

A11 A12 A13 A14 A15 ... A1n
A21 A22 A23
A31
A41
A51
...
Am1 Am2 Am3 Am4 Am5 ... Amn

The number of rows is not the same to the number of columns

Thanks in advance

Did you even try searching?

Another approch with awk:

awk '{ for (i=1;i<=NF;i++) { arr=arr" "$i; }} END{ for(i=1;i<=NF;i++) print arr; }' file