s = eval(input())



cnt = 0

li = []

for i in range(len(s)):

    if s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T':

        cnt += 1

    else:

        li.append(cnt)

        cnt = 0



li.append(cnt)

print((max(li)))
s = eval(input())

l = []

cnt = 0

for c in s:

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

        cnt += 1

    else:

        l.append(cnt)

        cnt = 0



l.append(cnt)

print((max(l)))
s = eval(input())
cnt = 0
li = []
for i in range(len(s)):
    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
        cnt += 1
    else:
        li.append(cnt)
        cnt = 0
li.append(cnt)
print((max(li)))

s = eval(input())
l = []
cnt = 0
for c in s:
    if c == "A" or c == "C" or c == "G" or c == "T":
        cnt += 1
    else:
        l.append(cnt)
        cnt = 0
l.append(cnt)
print((max(l)))

+l = [] -li = [] -for i in range(len(s)): -    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T": +for c in s: +    if c == "A" or c == "C" or c == "G" or c == "T": -        li.append(cnt) +        l.append(cnt) -li.append(cnt) -print((max(li))) +l.append(cnt) +print((max(l)))