Rectangle Detection

AtCoder
IDabc269_b
Time2000ms
Memory256MB
Difficulty
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}$ [samples]
Samples
Input #1
..........
..........
..........
..........
...######.
...######.
...######.
...######.
..........
..........
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.
Input #2
..........
..#.......
..........
..........
..........
..........
..........
..........
..........
..........
Output #2
2 2
3 3
Input #3
##########
##########
##########
##########
##########
##########
##########
##########
##########
##########
Output #3
1 10
1 10
API Response (JSON)
{
  "problem": {
    "name": "Rectangle Detection",
    "description": {
      "content": "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$ sat",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc269_b"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Takahashi generated $10$ strings $S_1,S_2,\\dots,S_{10}$ as follows.\n\n*   First, let $S_i (1 \\le i \\le 10)=$ `..........` ($10$ `.`s in a row).\n*   Next, choose four integers $A$, $B$, $C$, and $D$ sat...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments