
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector as V
import qualified Data.ByteString.Char8 as C
import qualified Data.Array.IO as A
import Debug.Trace
import Data.List
import Control.Monad
import Data.Ord

--import qualified Data.IntSet as S
import qualified Data.Sequence as S

r :: Int -> IO (U.Vector Int)
r n = U.unfoldrN n (C.readInt . C.dropWhile (==' ')) <$> C.getLine

r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine

main :: IO ()
main = do
    s <- getLine :: IO String
    let grS = procPair $ map length (group s)
    --print grS
    let inps = map solveS grS
    --print inps
    putStrLn $ printer $ concat $ zipWith zipper grS inps


printer :: [Int] -> String
printer xs = intercalate " " (map show xs)

zipper :: (Int,Int) -> (Int,Int) -> [Int]
zipper (r,l) (x,y) = replicate (r-1) 0 ++ [x,y] ++ replicate (l-1) 0 


procPair :: [Int] -> [(Int,Int)]
procPair []     = []
procPair [x]    = []
procPair (x:y:xs) = (x,y):(procPair xs)


solveS :: (Int,Int) -> (Int,Int)
solveS (r,l)
    | even (r+l)    = let m = div (r+l) 2
                        in (m,m)
    | r > l && even r = let n = div (r+l) 2 ; m = n+1
                        in (n,m)
    | r > l && odd  r = let n = div (r+l) 2 ; m = n+1
                        in (m,n)
    | r < l && even l = let n = div (r+l) 2 ; m = n+1
                        in (m,n)
    | r < l && odd  l = let n = div (r+l) 2 ; m = n+1
                        in (n,m)

