#P4147. Largest 'F' Subrectangle
Largest 'F' Subrectangle
Largest 'F' Subrectangle
This problem involves a grid of size \(N \times M\) where each cell is marked with either 'R' or 'F'. The character 'F' represents land granted to freda, while 'R' represents land granted to rainbow. freda wants to sell her charm by finding a rectangular piece of land that is entirely composed of 'F's. Your task is to help find the area of the largest such rectangle.
If the maximum area is \(S\), then you will receive \(S\) silver coins from each of them. Solve the problem and determine \(S\).
inputFormat
The first line contains two integers \(N\) and \(M\) (\(1 \leq N, M \leq 1000\)), representing the number of rows and columns of the grid. The following \(N\) lines each contain a string of length \(M\) consisting solely of the characters 'R' and 'F'.
outputFormat
Output a single integer, which is the area of the largest rectangle that contains only the character 'F'.
sample
4 5
RFRFR
RFFFF
FFFFF
RFRFF
8