Decalcomania
InterviewTime limit1sMemory limit1024 MB
Given an N by M grid of paint letters and dots, fold it in half left to right and print the result, letting each cell keep the paint where the two halves meet.
- Level
Easy3 of 10
- Topics
- Implementation, Array, Simulation, String
- Solved
- No attempts yet
Problem
Hee-gwon, worn out from exams and assignments, took up drawing as a hobby.

He does not like how the picture turned out, so he wants to turn it into a decalcomania.

As shown above, folding the picture in half from left to right makes the paint bleed where the two sides meet, completing the decalcomania.
Since a folded picture cannot be unfolded, Hee-gwon wants to know the result in advance.
Tell Hee-gwon the result of turning the picture into a decalcomania.
Input
The first line gives the picture's height N and width M as integers. (1 ≤ N, M ≤ 50, M is even)
N lines follow, each with M characters of information about the picture.
There are 26 kinds of paint, each represented by one uppercase alphabet letter.
A painted spot in the picture is written as the letter of its paint, and an empty spot as '.'. The picture's width is even, and when the picture is folded, no two paints overlap.
Output
Print the decalcomania picture over N lines.