102691: [AtCoder]ABC269 B - Rectangle Detection

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $200$ points

Problem Statement

Takahashi generated $10$ strings $S_1,S_2,\dots,S_{10}$ as follows.

  • First, let $S_i (1 \le i \le 10)=$ .......... ($10$ .s in a row).
  • Next, choose four integers $A$, $B$, $C$, and $D$ satisfying all of the following.
    • $1 \le A \le B \le 10$.
    • $1 \le C \le D \le 10$.
  • Then, for every pair of integers $(i,j)$ satisfying all of the following, replace the $j$-th character of $S_i$ with #.
    • $A \le i \le B$.
    • $C \le j \le D$.

You are given $S_1,S_2,\dots,S_{10}$ generated as above. Find the integers $A$, $B$, $C$, and $D$ Takahashi chose.
It can be proved that such integers $A$, $B$, $C$, and $D$ uniquely exist (there is just one answer) under the Constraints.

Constraints

  • $S_1,S_2,\dots,S_{10}$ are strings, each of length $10$, that can be generated according to the Problem Statement.

Input

The input is given from Standard Input in the following format:

$S_1$
$S_2$
$\vdots$
$S_{10}$

Output

Print the answer in the following format:

$A$ $B$
$C$ $D$

Sample Input 1

..........
..........
..........
..........
...######.
...######.
...######.
...######.
..........
..........

Sample Output 1

5 8
4 9

Here, Takahashi chose $A=5$, $B=8$, $C=4$, $D=9$.
This choice generates $10$ strings $S_1,S_2,\dots,S_{10}$, each of length $10$, where the $4$-th through $9$-th characters of $S_5,S_6,S_7,S_8$ are #, and the other characters are ..
These are equal to the strings given in the input.


Sample Input 2

..........
..#.......
..........
..........
..........
..........
..........
..........
..........
..........

Sample Output 2

2 2
3 3

Sample Input 3

##########
##########
##########
##########
##########
##########
##########
##########
##########
##########

Sample Output 3

1 10
1 10

Input

题意翻译

给你一个 $10 \times 10$ 的字符矩阵,寻找一个里面全是 `#` 号的矩阵,输出这个矩阵的最左上方的点的坐标和最右下方的点的坐标。 输出形式为: ``` A B C D ``` $A$ 表示最左上方点的纵坐标,$B$ 表示最右下方的纵坐标,$C$ 表示最左上方的横坐标,$D$ 表示最右下方的横坐标。

Output

分数:200分

问题描述

高桥生成了10个字符串$S_1,S_2,\dots,S_{10}$,方法如下。

  • 首先,令$S_i (1 \le i \le 10)=$ ..........(连续10个.)。
  • 接下来,选择四个满足以下条件的整数$A$,$B$,$C$和$D$。
    • $1 \le A \le B \le 10$。
    • $1 \le C \le D \le 10$。
  • 然后,对于满足以下条件的每对整数$(i,j)$,将$S_i$的第$j$个字符替换为#
    • $A \le i \le B$。
    • $C \le j \le D$。

您将得到按照上述方法生成的$S_1,S_2,\dots,S_{10}$。找出高桥选择的整数$A$,$B$,$C$和$D$。
可以证明,在约束条件下,这样的整数$A$,$B$,$C$和$D$是唯一存在的(只有一个答案)。

约束

  • $S_1,S_2,\dots,S_{10}$是字符串,每个长度为10,可以根据问题描述生成。

输入

输入从标准输入给出,格式如下:

$S_1$
$S_2$
$\vdots$
$S_{10}$

输出

以以下格式打印答案:

$A$ $B$
$C$ $D$

样例输入1

..........
..........
..........
..........
...######.
...######.
...######.
...######.
..........
..........

样例输出1

5 8
4 9

这里,高桥选择了$A=5$,$B=8$,$C=4$,$D=9$。
这种选择生成了10个长度为10的字符串$S_1,S_2,\dots,S_{10}$,其中$S_5,S_6,S_7,S_8$的第4个到第9个字符为#,其他字符为.
这些字符串与输入中给出的字符串相同。


样例输入2

..........
..#.......
..........<

加入题单

算法标签: