Under construction

Still being built. Things may change

Satellite Photographs

Interview

Time limit1sMemory limit1024 MB

Summary
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.
Level

Easy3 of 10

Topics
BFS, Matrix
Solved
No attempts yet

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.

Examples1

  1. Example 1

    Input
    10 5
    ..*.....**
    .**..*****
    .*...*....
    ..****.***
    ..****.***
    
    Expected output
    16