S = eval(input())

L = 'ACGT'

n, num = 0, 0

for s in S:

    if s in L:

        n += 1

    else:

        num = max(num, n)

        n = 0

num = max(num, n)

print(num)
S = eval(input())

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

n, num = 0, 0

for s in S:

    if s in L:

        n += 1

    else:

        num = max(num, n)

        n = 0

num = max(num, n)

print(num)
S = eval(input())
L = "ACGT"
n, num = 0, 0
for s in S:
    if s in L:
        n += 1
    else:
        num = max(num, n)
        n = 0
num = max(num, n)
print(num)

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

-L = "ACGT" +L = ["A", "T", "C", "G"]