import Data.List

main = do
   line <- getLine
   let raw        = words line
   let compressed = map count (group raw) :: [(Int, Int)]
   let serialized = concat $ map ((a,b) -> [show a, show b]) compressed
   putStrLn $ show $ unwords serialized
   where count xs = (length xs, read $ xs !! 0)


$ ./test
255 255 255 254 254 253 253 253 250 250 250 250 250 0
"3 255 2 254 3 253 5 250 1 0"
$

문자열과 정수를 오가는게 쉽지 않네여