
s = gets.chomp.to_s
leng = s.length
rang = (leng + 1) / 2
sub_list = [""]

for i in 0..leng-1 do
  for j in 0..leng - 1 - i do
    sub_list.unshift(s[i..i+j])
  end
end

sub_list = sub_list.uniq
ans = -1

for str in sub_list do
  a_count = str.count("A")
  c_count = str.count("C")
  g_count = str.count("G")
  t_count = str.count("T")
  leng = str.length

  if (a_count + c_count + g_count + t_count) == leng
    s_leng = str.length
    ans = s_leng if s_leng > ans
  end
end

puts ans
