atcoder#ABC269B. [ABC269B] Rectangle Detection
[ABC269B] Rectangle Detection
Score : points
Problem Statement
Takahashi generated strings as follows.
- First, let
..........
(.
s in a row). - Next, choose four integers , , , and satisfying all of the following.- .
- .
- .
- .
- Then, for every pair of integers satisfying all of the following, replace the -th character of with
#
.- .- .
- .
- .
You are given generated as above. Find the integers , , , and Takahashi chose. It can be proved that such integers , , , and uniquely exist (there is just one answer) under the Constraints.
Constraints
- are strings, each of length , that can be generated according to the Problem Statement.
Input
The input is given from Standard Input in the following format:
Output
Print the answer in the following format:
..........
..........
..........
..........
...######.
...######.
...######.
...######.
..........
..........
5 8
4 9
Here, Takahashi chose , , , .
This choice generates strings , each of length , where the -th through -th characters of are #
, and the other characters are .
.
These are equal to the strings given in the input.
..........
..#.......
..........
..........
..........
..........
..........
..........
..........
..........
2 2
3 3
##########
##########
##########
##########
##########
##########
##########
##########
##########
##########
1 10
1 10