Satellite Photographs
InterviewTime limit1sMemory limit1024 MB
Given a W by H grid of pasture (*) and other (.) pixels, find the size of the largest group of horizontally or vertically connected pasture pixels.
Problem
Farmer John bought satellite photos of his farm. Each photo is W x H pixels (1 ≤ W ≤ 80, 1 ≤ H ≤ 1000). He wants to find the largest connected pasture in each photo. Two pasture pixels are connected when you can walk between them through horizontally or vertically adjacent pasture pixels. Pasture pixels are shown as * and other pixels as .. Pasture shapes can be very strange, even circles that surround other circles.
Input
The first line contains two space-separated integers, W and H. Each of the next H lines contains W characters, each either * or ., describing one raster line of the photo.
Output
Print the size of the largest connected pasture, in pixels, on one line.