a = input()
j = 0
b = []
dna = ['A', 'T', 'C', 'G']
for i in range(len(a)):
if a[i] in dna:
j += 1
else:
j = 0
b.append(j)
print(max(b))
j = 0
b = []
dna = ['A', 'T', 'C', 'G']
for i in range(len(a)):
if a[i] in dna:
j += 1
else:
j = 0
b.append(j)
print(max(b))