import Data.List
import Control.Monad
import Data.Array.Unboxed
import Data.Array.MArray
import Data.Array.ST
import Control.Monad.ST

--import Debug.Trace

type Field s = STUArray s (Int,Int) Int

modifyArray :: (MArray a e m ,Ix i) => a i e -> i -> (e -> e) -> m ()
modifyArray arr i f =  readArray arr i >>= writeArray arr i . f

f :: Field s -> Int -> [[Char]] -> ST s ()
f arr' y [] = return ()
f arr' y (s:field) = do
  sub arr' 1 $ group s
  f arr' (y+1) field
  where
    sub :: Field s -> Int -> [[Char]] -> ST s ()
    sub arr i [] = return ()
    sub arr i (a:bs) = if head a == '.' then do
        --traceShowM (i,length a)
        forM [i..i+(length a)-1] $ \i' -> modifyArray arr (y,i') (+(length a))
        sub arr (i+(length a)) bs
      else do
        sub arr (i+(length a)) bs

g :: Field s -> Int -> [[Char]] -> ST s ()
g arr' x [] = return ()
g arr' x (s:field) = do
  sub arr' 1 $ group s
  g arr' (x+1) field
  where
    sub :: Field s -> Int -> [[Char]] -> ST s ()
    sub arr i [] = return ()
    sub arr i (a:bs) = if head a == '.' then do
        --traceShowM (i,length a)
        forM [i..i+(length a)-1] $ \i' -> modifyArray arr (i',x) (+(length a))
        sub arr (i+(length a)) bs
      else do
        sub arr (i+(length a)) bs

solve :: Int -> Int -> [[Char]] -> ST s Int
solve h w field = do
  arr <- newListArray ((1,1),(h,w)) $ repeat (-1)
  --fileld <- newlistArray ((1,1),(h,w)) $ concat list
  f arr 1 field
  --traceShowM $ show "---------------------"
  g arr 1 (transpose field)
  list <- forM [1..h] $ \y -> do
    forM [1..w] $ \x -> do
      readArray arr (y,x)

  return $ maximum $ concat list

main :: IO ()
main = do
  [h,w] <- map read.words<$> getLine :: IO [Int]
  field <- replicateM h getLine
  print $ runST $ solve h w field
