import Control.Monad

main :: IO ()
main = do
  wh <- getLine
  
  let wh' :: [Int]
      wh' = map read (words wh)
  ss <- replicateM (head wh') getLine
  let ans = fix (solve ss)
  mapM putStrLn ans
  return ()

solve :: [String] -> [[Int]]
solve [] = []
solve (xs:xss) = (change xs):(solve xss)
  where
    change :: String -> [Int]
    change ss = change' ss (-1000)
      where
        change' :: String -> Int -> [Int]
        change' [] count = []
        change' ('c':xs) count = (0:(change' xs 1))
        change' ('.':xs) count
          | count < 0 = (-1:(change' xs count))
          | otherwise = (count:(change' xs (count+1)))
fix :: [[Int]] -> [String]
fix [] = []
fix (x:xs) = (fix' x):(fix xs)
  where
    fix' :: [Int] -> String
    fix' [] = ""
    fix' (x:xs) = ((show x) ++ " ") ++ (fix' xs)