#C2228. Largest Identical Square
Largest Identical Square
Largest Identical Square
You are given an n x m grid filled with uppercase letters. Your task is to determine the size of the largest square subgrid such that all the characters in the square are identical.
Formally, you should find the maximum integer \(k\) such that there exists some square of size \(k \times k\) in the grid, and all cells within that square contain the same letter.
Example:
Input: 3 3 AAA ABA AAA</p>Output: 1
In the above example, even though there are many contiguous areas with the same letter, the largest square with all identical characters is of size \(1 \times 1\).
inputFormat
The first line contains two integers n and m representing the number of rows and columns in the grid, respectively. Each of the next n lines contains a string of m uppercase letters representing a row of the grid.
outputFormat
Output a single integer representing the size of the largest square (i.e., the length of its side) in which all characters are identical.
## sample3 3
AAA
ABA
AAA
1