S=eval(input())

r=0

c=0

for s in S:

    if s=='A'or s=='T'or s=='C'or s=='G':

        c+=1

        r=max(r,c)

    else:

        c=0

print(r)
S=eval(input())

c=0

r=0

for s in S:

    if s in 'ATCG':

        c+=1

        r=max(r,c)

    else:

        c=0

print(r)
S = eval(input())
r = 0
c = 0
for s in S:
    if s == "A" or s == "T" or s == "C" or s == "G":
        c += 1
        r = max(r, c)
    else:
        c = 0
print(r)

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

+c = 0 -c = 0 -    if s == "A" or s == "T" or s == "C" or s == "G": +    if s in "ATCG":