A. Rotate, Flip and Zoom
time limit per test
memory limit per test
input
output
Polycarp is writing the prototype of a graphic editor. He has already made up his mind that the basic image transformations in his editor will be: rotate the image 90 degrees clockwise, flip the image horizontally (symmetry relative to the vertical line, that is, the right part of the image moves to the left, and vice versa) and zooming on the image. He is sure that that there is a large number of transformations that can be expressed through these three.
He has recently stopped implementing all three transformations for monochrome images. To test this feature, he asked you to write a code that will consecutively perform three actions with a monochrome image: first it will rotate the image 90 degrees clockwise, then it will flip the image horizontally and finally, it will zoom in twice on the image (that is, it will double all the linear sizes).
Implement this feature to help Polycarp test his editor.
Input
w and h (1 ≤ w, h ≤ 100) — the width and height of an image in pixels. The picture is given in hlines, each line contains w characters — each character encodes the color of the corresponding pixel of the image. The line consists only of characters "." and "*", as the image is monochrome.
Output
2w lines, each containing 2h
Sample test(s)
input
3 2 .*. .*.
output
.... .... **** **** .... ....
input
9 20
**.......
****.....
******...
*******..
..******.
....****.
......***
*.....***
*********
*********
*********
*********
....**...
...****..
..******.
.********
****..***
***...***
**.....**
*.......*
output
********......**********........********
********......**********........********
********........********......********..
********........********......********..
..********......********....********....
..********......********....********....
..********......********..********......
..********......********..********......
....********....****************........
....********....****************........
....********....****************........
....********....****************........
......******************..**********....
......******************..**********....
........****************....**********..
........****************....**********..
............************......**********
............************......**********
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<queue>
#include<stack>
using namespace std;
char map[210][210];
char mm[210][210];
int n,m;
int main()
{
while(scanf("%d%d",&m,&n)!=EOF)
{
for(int i=0;i<n;i++)
{
scanf("%s",mm[i]);
}
for(int i=0;i<m;i++)
{
int k = 0;
for(int j=n-1;j>=0;j--)
{
map[i][k++] = mm[j][i];
}
map[i][k] = '\0';
}
for(int i=0;i<m;i++)
{
for(int j=n-1;j>=0;j--)
{
printf("%c%c",map[i][j],map[i][j]);
}
printf("\n");
for(int j=n-1;j>=0;j--)
{
printf("%c%c",map[i][j],map[i][j]);
}
printf("\n");
}
}
return 0;
}