#C8143. Largest Rectangular Park Area

    ID: 52093 Type: Default 1000ms 256MiB

Largest Rectangular Park Area

Largest Rectangular Park Area

You are given a grid representing city lots. Each cell is marked either as A indicating an available lot or B indicating a built-up area. Your task is to compute the area of the largest rectangular park that can be constructed using only available lots.

The park must be a contiguous rectangle consisting entirely of cells marked A. Formally, if you denote the grid as a matrix, you are to find the maximum area of a submatrix containing only A cells.

The area is calculated as \( \text{area} = \text{height} \times \text{width} \).

Note: The rectangle must have at least one cell in width and one row in height.

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 \(m\) space-separated characters, each being either A (available) or B (built-up).

outputFormat

Output a single integer, which is the area of the largest rectangular park that can be built on available lots.

## sample
2 2
A B
B A
1

</p>