S = eval(input())

ans = 0

l = 0

for i in range(len(S)):

    if S[i] in ('A','C','G','T'):

        l += 1

    else:

        ans = max(ans,l)

        l = 0

ans = max(ans,l)

print(ans)

S = eval(input())

ans = 0

now = 0

for i in range(len(S)):

    if S[i] in ['A','T','G','C']:

        now += 1

    else:

        ans = max(ans,now)

        now = 0

ans = max(ans,now)

print(ans)
S = eval(input())
ans = 0
l = 0
for i in range(len(S)):
    if S[i] in ("A", "C", "G", "T"):
        l += 1
    else:
        ans = max(ans, l)
        l = 0
ans = max(ans, l)
print(ans)

S = eval(input())
ans = 0
now = 0
for i in range(len(S)):
    if S[i] in ["A", "T", "G", "C"]:
        now += 1
    else:
        ans = max(ans, now)
        now = 0
ans = max(ans, now)
print(ans)

-l = 0 +now = 0 -    if S[i] in ("A", "C", "G", "T"): -        l += 1 +    if S[i] in ["A", "T", "G", "C"]: +        now += 1 -        ans = max(ans, l) -        l = 0 -ans = max(ans, l) +        ans = max(ans, now) +        now = 0 +ans = max(ans, now)