let to_list str = let rec doit i acc = if i < 0 then acc else doit (i - 1) (String.get str i :: acc) in doit (String.length str - 1) [] let () = read_line () |> String.map (fun c -> if c >= '0' && c <= '9' then c else '0') |> to_list |> List.map (fun c -> Char.code c - Char.code '0') |> List.fold_left (+) 0 |> Printf.printf "%d\n"