s=eval(input())

ans=0

start=-1

for i in range(len(s)):

    if not s[i] in "ACGT":

        ans=max(ans,i-start-1)

        start=i

    i+=1

ans=max(ans,i-start-1)

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

ans=0

cnt=0

for c in s:

    if c in "ATCG":

        cnt+=1

    else:

        cnt=0

    ans=max(ans,cnt)

print(ans)

s = eval(input())
ans = 0
start = -1
for i in range(len(s)):
    if not s[i] in "ACGT":
        ans = max(ans, i - start - 1)
        start = i
    i += 1
ans = max(ans, i - start - 1)
print(ans)

s = eval(input())
ans = 0
cnt = 0
for c in s:
    if c in "ATCG":
        cnt += 1
    else:
        cnt = 0
    ans = max(ans, cnt)
print(ans)

-start = -1 -for i in range(len(s)): -    if not s[i] in "ACGT": -        ans = max(ans, i - start - 1) -        start = i -    i += 1 -ans = max(ans, i - start - 1) +cnt = 0 +for c in s: +    if c in "ATCG": +        cnt += 1 +    else: +        cnt = 0 +    ans = max(ans, cnt)