let rec check str maxN bufN =
  let len = (String.length str) in
  if len = 0 then maxN
  else
    let headS = str.[0] in
    let newStr = String.sub str 1 (len - 1) in
    if headS = 'A' || headS = 'T' || headS = 'C' || headS = 'G' then
      let newBufN = bufN + 1 in
      check newStr maxN newBufN
    else
    if maxN <= bufN then
      check newStr bufN 0
    else
      check newStr maxN 0
let () = Scanf.scanf "%s\n"
    (fun str -> check str 0 0)
         |> print_int