(*
ocamlfind ocamlopt -package batteries -linkpkg main.ml -o a.out
*)
open Batteries

let () = 
        (let lst = Str.split (Str.regexp "[B|D|E|F|H|I|J|K|L|M|N|O|P|Q|R|S|U|V|W|X|Y|Z]") (read_line ()) in
                 if lst = [] then
                         0
                 else
                         List.sort (fun a b ->
                                 let alen = String.length a in
                                 let blen = String.length b in
                                         if alen = blen then
                                                 0
                                         else 
                                         if alen < blen then
                                                 1
                                         else
                                                 -1
                         ) lst
                         |> List.hd
                         |> String.length
        )
        |> Printf.printf "%d\n"
