s = eval(input())

m =0

count =0

for i in s:

    if i in 'A':

        count += 1

    elif i in'C':

        count += 1

    elif i in 'G':

        count += 1

    elif i in 'T':

        count += 1

    else:

        count = 0

    m =max(m,count)

print(m)
s=eval(input())

r=0

count=0

for i in range(len(s)):

  if s[i]=='A' or s[i]=='C' or s[i]=='G' or s[i]=='T':

    count +=1

    r=max(r,count)

  else:

    count=0

print(r)
s = eval(input())
m = 0
count = 0
for i in s:
    if i in "A":
        count += 1
    elif i in "C":
        count += 1
    elif i in "G":
        count += 1
    elif i in "T":
        count += 1
    else:
        count = 0
    m = max(m, count)
print(m)

s = eval(input())
r = 0
count = 0
for i in range(len(s)):
    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
        count += 1
        r = max(r, count)
    else:
        count = 0
print(r)

-m = 0 +r = 0 -for i in s: -    if i in "A": +for i in range(len(s)): +    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T": -    elif i in "C": -        count += 1 -    elif i in "G": -        count += 1 -    elif i in "T": -        count += 1 +        r = max(r, count) -    m = max(m, count) -print(m) +print(r)