{-# LANGUAGE BangPatterns #-}
import Control.Arrow
import Control.Monad.Fix
import Data.Char
import Data.Int
import Data.Foldable
import Data.List
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as VU
import qualified Data.ByteString.Char8 as B
import Debug.Trace

solve :: Int -> Int -> V.Vector (VU.Vector Bool) -> Int
solve !h !w !sn = (\n -> n - 1) $ maximum
  [ toRight V.! j VU.! i + toDown V.! i VU.! j
  | i <- [0 .. w - 1]
  , j <- [0 .. h - 1]
  ]
 where
  toRight = V.map VU.fromList $ V.map toCountArray sn
  toDown  = V.map VU.fromList $ V.map toCountArray $ transpose sn

  transpose vs = V.fromList
    [ VU.fromList [ vs V.! i VU.! j | i <- [0 .. h - 1] ] | j <- [0 .. w - 1] ]

  toCountArray s = reverse $ (\(x, _, _) -> x) $ VU.ifoldl'
    ( \(!acc, !sk, !pch) !i !ch -> if pch /= ch
      then let sk' = tail sk in (head sk' : acc, sk', ch)
      else (head sk : acc, sk, ch)
    )
    ([], toGroup s, VU.head s)
    s
  toGroup si = map length $ group $ VU.toList $ si

main = do
  let readInt :: Integral a => B.ByteString -> Maybe (a, B.ByteString)
      readInt = fmap (first fromIntegral . second B.tail) . B.readInt

  (h, w) <-
    (\vec -> (vec VU.! 0, vec VU.! 1)) . VU.unfoldrN 2 readInt <$> B.getLine
  sn <-
    V.replicateM h
    $   VU.fromList
    .   map (\ch -> ch == '#')
    .   B.unpack
    <$> B.getLine
  print $ solve h w sn
