#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main() { int i, j; int r, k, h, w; //vector>c(10, vector(10, -1)); vectorc,c2; cin >> r >> k; cin >> h >> w; for (i = 0; i < h; i++) { string st; cin >> st; c.push_back(st); } int h2 = h, w2 = w; if (r == 90) { h2 = w; w2 = h; string st; for (i = 0; i < w2; i++) { st += 'a'; } for (i = 0; i < h2; i++) { c2.push_back(st); } for (i = 0; i < h2; i++) { for (j = 0; j < w2; j++) { c2[i][j] = c[h - j - 1][i]; } } } if (r == 180) { //h2 = w; //w2 = h; string st; for (i = 0; i < w2; i++) { st += 'a'; } for (i = 0; i < h2; i++) { c2.push_back(st); } for (i = 0; i < h2; i++) { for (j = 0; j < w2; j++) { c2[i][j] = c[h2 - i -1][w2 - j - 1]; } } } if (r == 270) { vectorc3; string st2; for (i = 0; i < w2; i++) { st2 += 'a'; } for (i = 0; i < h2; i++) { c3.push_back(st2); } for (i = 0; i < h2; i++) { for (j = 0; j < w2; j++) { c3[i][j] = c[h2 - i - 1][w2 - j - 1]; } } h2 = w; w2 = h; string st; for (i = 0; i < w2; i++) { st += 'a'; } for (i = 0; i < h2; i++) { c2.push_back(st); } for (i = 0; i < h2; i++) { for (j = 0; j < w2; j++) { c2[i][j] = c3[h - j - 1][i]; } } /* h2 = w; w2 = h; string st; for (i = 0; i < w2; i++) { st += 'a'; } for (i = 0; i < h2; i++) { c2.push_back(st); } for (i = 0; i < h2; i++) { for (j = 0; j < w2; j++) { c2[i][j] = c[j][i]; } }*/ } if (r == 0) { h2 = h; w2 = w; string st; for (i = 0; i < w2; i++) { st += 'a'; } for (i = 0; i < h2; i++) { c2.push_back(st); } for (i = 0; i < h2; i++) { for (j = 0; j < w2; j++) { c2[i][j] = c[i][j]; } } } //cout << endl; for (i = 0; i < h2 * k; i++) { for (j = 0; j < w2 * k; j++) { if (i == 0 && j == 0) { //cout << c2[1 / k][1 / k]; cout << c2[0][0]; } else if (i == 0) { //cout << c2[1 / k][j / k]; cout << c2[0][j / k]; } else if (j == 0) { //cout << c2[i / k][1 / k]; cout << c2[i / k][0]; } else { cout << c2[i / k][j / k]; } } cout << endl; } //cout << endl; getchar(); getchar(); return 0; }