def erase(str)
  allowed = "ACGT"
  n = str.length - 1
  for i in 0..(n / 2)
    if !allowed.include?(str[i])
      return "l"
    elsif !allowed.include?(str[n - i])
      return "r"
    end
  end
  return nil
end

# Main Loop
input = STDIN.gets().chomp

while (r = erase(input)) != nil
  if r == "l"
    input.slice!(0)
  elsif r == "r"
    input.chop!
  else
    puts "program bug"
    break
  end
end

puts input.length
