let () =
  let rec print_tbl tbl = function
    | 'a'..'z' as c ->
      Printf.printf "%c : %d\n"
        c (if Hashtbl.mem tbl c then Hashtbl.find tbl c else 0);
      print_tbl tbl (Char.code c |> (+) 1 |> Char.chr)
    | _ -> ()
  in
  let buf = Buffer.create 1024 in
  try
    while true do
      Buffer.add_string buf (read_line ());
    done
  with End_of_file ->
    let chars = Buffer.contents buf in
    let rec loop tbl = function
      | -1 -> tbl
      | i ->  match chars.[i] with
        | 'a'..'z' | 'A'..'Z' as c ->
          let lc = Char.lowercase c in
          Hashtbl.replace tbl lc
            (if Hashtbl.mem tbl lc then Hashtbl.find tbl lc |> (+) 1 else 1);
          loop tbl (i-1)
        | _ -> loop tbl (i-1)
    in
    let tbl = loop (Hashtbl.create 32) ((String.length chars) - 1) in
    print_tbl tbl 'a'