spoj#JOCHEF. Farmer Sepp
Farmer Sepp
Chief Farmer Josef aka Sepp needs to crop hay several times through the summer. Due to high petrol costs he can currently use his truck only once to drive to a spot where he will harvest the dried grass. Lazy by nature, John does not want to harvest those parts of the field which contain cows, since this would involve too much energy. Furthermore, John just crops a rectangular part of the field.
Input
Input contains multiple test cases. You are given three integers M, N, F (0 < M, N <= 4000), (0 <= F <= 1000000) which describe the size of the field (M rows, N columns, F unit area of such a field). Then follows the actual map which consists of M lines, each line containing N times the letters 'H' or 'C' standing for "Hay" or "Cow". Input terminates with M = N = 0.
Output
Print the size of the largest field, which "Sepp" would harvest.
Example
Input: 9 10 1 CHCHHHCCCC CCHCHCHHHC CCHCHHCCCC CHHHHHCHHH CHCHHHCCCH CCCCHHHCHH HHHCCHCCCC HCHHHHCCCH CHHCCCCHHC 0 0</p>Output: 8