import Control.Applicative

solver :: String -> [String]
solver xs = map (show . length) $ words xs

check :: [String] -> [[String]]
check [] = []
check (x:xs)
  | x == "END OF INPUT" = []
  | otherwise           = solver x : check xs

main :: IO()
main = do
  contents <- lines <$> getContents
  mapM_ putStrLn $ map concat $ check contents