s = eval(input())

ans = 0

for l in range(len(s)):

    for r in range(l, len(s) + 1):

        t = s[l:r]

        if all(c in 'ACGT' for c in t):

            ans = max(ans, len(t))

print(ans)

s = eval(input())

ans = 0

tmp = 0

for c in s:

    if c in 'ACGT':

        tmp += 1

        ans = max(ans, tmp)

    else:

        tmp = 0

print(ans)

s = eval(input())
ans = 0
for l in range(len(s)):
    for r in range(l, len(s) + 1):
        t = s[l:r]
        if all(c in "ACGT" for c in t):
            ans = max(ans, len(t))
print(ans)

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

-for l in range(len(s)): -    for r in range(l, len(s) + 1): -        t = s[l:r] -        if all(c in "ACGT" for c in t): -            ans = max(ans, len(t)) +tmp = 0 +for c in s: +    if c in "ACGT": +        tmp += 1 +        ans = max(ans, tmp) +    else: +        tmp = 0