# ABC122 B-ATCoder



S = eval(input())

ans = 0

l, r = 0, 0

ls = len(S)



for i in range(ls):

    if S[i] in "ATGC":

        r += 1

    else:

        r += 1

        l = r

    ans = max(ans, r-l)

print(ans)
S = eval(input())

tf = []

for s in S:

    if s in "ACGT":

        tf.append(True)

    else:

        tf.append(False)



ans = 0

temp = 0

for res in tf:

    if res:

        temp += 1

    else:

        temp = 0

    ans = max(ans, temp)

print(ans)
# ABC122 B-ATCoder
S = eval(input())
ans = 0
l, r = 0, 0
ls = len(S)
for i in range(ls):
    if S[i] in "ATGC":
        r += 1
    else:
        r += 1
        l = r
    ans = max(ans, r - l)
print(ans)

S = eval(input())
tf = []
for s in S:
    if s in "ACGT":
        tf.append(True)
    else:
        tf.append(False)
ans = 0
temp = 0
for res in tf:
    if res:
        temp += 1
    else:
        temp = 0
    ans = max(ans, temp)
print(ans)

-# ABC122 B-ATCoder +tf = [] +for s in S: +    if s in "ACGT": +        tf.append(True) +    else: +        tf.append(False) -l, r = 0, 0 -ls = len(S) -for i in range(ls): -    if S[i] in "ATGC": -        r += 1 +temp = 0 +for res in tf: +    if res: +        temp += 1 -        r += 1 -        l = r -    ans = max(ans, r - l) +        temp = 0 +    ans = max(ans, temp)