let () =
  let rec read () =
    let line = read_line () in
    if line = "END OF INPUT" then ()
    else
      begin
        let len = String.length line in
        let rec loop cnt s i =
          if i = len then s^(string_of_int cnt)
          else
            begin
              if (Char.code line.[i]) = 32 then
                loop 0 (s^(string_of_int cnt)) (i+1)
              else
                loop (cnt+1) s (i+1)
            end
        in
        Printf.printf "%s\n" (loop 0 "" 0);
        read ()
      end
  in read ()
;;