经典题目不多说
var f:array[..,..] of longint;
l,r:array[..] of longint;
i,j,n,m,ans:longint;
x:char; function max(a,b:longint):longint;
begin
if a>b then exit(a) else exit(b);
end; begin
readln(n,m);
for i:= to n do
begin
for j:= to m do
begin
read(x);
if x=' ' then read(x);
if x='F' then
f[i,j]:=f[i-,j]+
else f[i,j]:=;
end;
readln;
end; for i:= to n do
begin
l[]:=;
for j:= to m do
begin
l[j]:=j;
while (l[j]->) and (f[i,j]<=f[i,l[j]-]) do l[j]:=l[l[j]-];
end;
r[m]:=m;
for j:=m- downto do
begin
r[j]:=j;
while (r[j]+<=m) and (f[i,j]<=f[i,r[j]+]) do r[j]:=r[r[j]+];
end;
for j:= to m do
ans:=max(ans,f[i,j]*(r[j]-l[j]+));
end;
writeln(*ans);
end.