let char_int char = if char > '9' then 0 else int_of_string (Char.escaped char) let rec main str i sum = if i = String.length str then sum else main str (i+1) (sum + char_int str.[i]) let () = print_int (main (read_line ()) 0 0)