import Control.Applicative
import Control.Monad
import Data.Maybe
import Data.List

main = read . head . words <$> getLine >>= flip replicateM getLine >>= mapM_ (putStrLn . unwords . map (show . fromMaybe (-1)) . tail . scanl f Nothing)
  where
    f _ 'c' = Just 0
    f m '.' = (+1) <$> m
