S = eval(input())

T = ["A", "C", "G", "T"]

ans = 0

t = 0

for e in S:

    if e in T:

        t += 1

    else:

        t = 0

    ans = max(ans,t)

print(ans)

S = eval(input())

L = ["A","T","C","G"]

ans = 0

t = 0

for e in S:

    if e in L:

        t += 1

        ans = max(ans,t)

    else:

        t = 0

print(ans)

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

S = eval(input())
L = ["A", "T", "C", "G"]
ans = 0
t = 0
for e in S:
    if e in L:
        t += 1
        ans = max(ans, t)
    else:
        t = 0
print(ans)

-T = ["A", "C", "G", "T"] +L = ["A", "T", "C", "G"] -    if e in T: +    if e in L: +        ans = max(ans, t) -    ans = max(ans, t)