find'::Eq a=>a->[] a->Int
find' x [] = 0
find' x (y:ys) =
  if y == x
    then 0
    else 1 + find' x ys
split::Char->String->[] String
split x [] = []
split x ys = take n ys : (split x (drop (n+1) ys))
  where
    n = find' x ys
format::[String]->String
format [x] = ""
format (x:xs) = x ++ "\n" ++ format xs
solve::[String]->String
solve [] = ""
solve (x:xs) = show (length x) ++ solve xs
main::IO ()
main = do
  getContents >>=
    putStr.format.(map solve).(map (split ' ')).(split '\n')
