s = eval(input())

left = 0

ans = 0

for right in range(0,len(s)):

  if s[right] in ("A","C","G","T"):

    pass

  else:

    left=right+1

  ans = max(ans,right-left+1)

print(ans)
s = eval(input())

ans = 0

for i in range(len(s)):

  for j in range(i,len(s)):

    if all("ATGC".count(c) == 1 for c in s[i:j+1]):

      ans = max(ans,j-i+1)

print(ans)
s = eval(input())
left = 0
ans = 0
for right in range(0, len(s)):
    if s[right] in ("A", "C", "G", "T"):
        pass
    else:
        left = right + 1
    ans = max(ans, right - left + 1)
print(ans)

s = eval(input())
ans = 0
for i in range(len(s)):
    for j in range(i, len(s)):
        if all("ATGC".count(c) == 1 for c in s[i : j + 1]):
            ans = max(ans, j - i + 1)
print(ans)

-left = 0 -for right in range(0, len(s)): -    if s[right] in ("A", "C", "G", "T"): -        pass -    else: -        left = right + 1 -    ans = max(ans, right - left + 1) +for i in range(len(s)): +    for j in range(i, len(s)): +        if all("ATGC".count(c) == 1 for c in s[i : j + 1]): +            ans = max(ans, j - i + 1)