You've been using the same computer for over a decade, and the screen has collected many cracks throughout the years. However, what infuriates you even more is the fact that the cracks aren't symmetrical!
Your screen can be modelled as a by grid, where each cell is either #
if it's cracked or .
if it isn't. You are willing to add some cracks to your screen until it's both vertically and horizontally symmetrical. Formally, in the output, every cell must have the same value as the cell and the cell .
Obviously, to minimize destruction to your screen, you would like to minimize the number of cracks you make. Please find the minimum number of cracks and output what your screen will look like after.
Constraints
and are even.
Input Specification
The first line contains two integers, and .
Each of the following lines contains a string of characters of either #
or .
.
Output Specification
On the first line, output the minimum number of cracks that you have to make.
Then, output strings of characters representing the screen after the cracks.
Sample Input 1
4 6
.#....
..##..
...#..
..#...
Sample Output 1
7
.####.
..##..
..##..
.####.
Comments