#include <iostream>
using namespace std;
int main ()
{
char A [3][3] =
{
{ 'a', 'b', 'c' },
{ 'd', 'e', 'f' },
{ 'g', 'h', 'i' }
};
cout << "A = " << endl << endl;
// print matrix A
for (int i=0; i<3; i++)
{
for (int j=0; j<3; j++)
cout << A[i][j];
cout << endl;
}
cout << endl << "A transpose = " << endl << endl;
// print A transpose
for (int i=0; i<3; i++)
{
for (int j=0; j<3; j++)
cout << A[j][i];
cout << endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluICgpCnsKICAgIGNoYXIgQSBbM11bM10gPQogICAgewogICAgICAgIHsgJ2EnLCAnYicsICdjJyB9LAogICAgICAgIHsgJ2QnLCAnZScsICdmJyB9LAogICAgICAgIHsgJ2cnLCAnaCcsICdpJyB9CiAgICB9OwogICAgCiAgICBjb3V0IDw8ICJBID0gIiA8PCBlbmRsIDw8IGVuZGw7CiAgICAKICAgIC8vIHByaW50IG1hdHJpeCBBCiAgICBmb3IgKGludCBpPTA7IGk8MzsgaSsrKQogICAgewogICAgICAgIGZvciAoaW50IGo9MDsgajwzOyBqKyspCiAgICAgICAgICAgIGNvdXQgPDwgQVtpXVtqXTsKICAgICAgICBjb3V0IDw8IGVuZGw7CiAgICB9CiAgICAKICAgIGNvdXQgPDwgZW5kbCA8PCAiQSB0cmFuc3Bvc2UgPSAiIDw8IGVuZGwgPDwgZW5kbDsKICAgIAogICAgLy8gcHJpbnQgQSB0cmFuc3Bvc2UKICAgIGZvciAoaW50IGk9MDsgaTwzOyBpKyspCiAgICB7CiAgICAgICAgZm9yIChpbnQgaj0wOyBqPDM7IGorKykKICAgICAgICAgICAgY291dCA8PCBBW2pdW2ldOwogICAgICAgIGNvdXQgPDwgZW5kbDsKICAgIH0KICAgIAogICAgcmV0dXJuIDA7Cn0=