peterverebics/CodeNet_Python_118 huggingface dataset:
# -*- coding: utf-8 -*-
# 標準入力を取得
S = input()

# 求解処理
ACGT = ["A", "C", "G", "T"]
ans = 0
N = len(S)
for i in range(N):
    for j in range(i, N):
        if all([S[k] in ACGT for k in range(i, j + 1)]):
            ans = max(ans, j - i + 1)

# 結果出力
print(ans)
S = input()

res = 0
cur = 0
N = len(S)
ACGT = ["A", "C", "G", "T"]
for i in range(N):
  if S[i] in ACGT:
    cur += 1
  else:
    cur = 0
  if cur > res:
    res = cur

print(res)
S=input()
l=len(S)
ans=0
str='ACGT'
for i in range(l):
    for j in range(i,l):
        if all (str.count(x)==1 for x in S[i:j+1]):
            ans=max(ans,j-i+1)
print(ans)
count = 0
ans = 0
s = input()
for i in range(len(s)):
    if s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T':
        if i != len(s)-1:
            count += 1
        else:
            count += 1
            ans = max(ans,count)
    else:
        ans = max(ans,count)
        count = 0
print(ans)
S=input()

ans=[]
count=0

for i in range(len(S)):
    if S[i]=="A" or S[i]=="C" or S[i]=="G" or S[i]=="T":
        count+=1
    else:
        ans.append(count)
        count=0

ans.append(count)

print(max(ans))
string_data = list(input())

N = len(string_data)
match_word_lits = ['A', 'C', 'G', 'T']
count = 0
max_word = 0
for i in range(N):
    if string_data[i] in match_word_lits:
        count += 1
        if max_word < count:
            max_word = count
    else:
        count = 0

print(max_word)
S=input()
T='ATCG'
 
flag =0
ans =0
 
for i in range(len(S)):
    flag =0
    for j in range(i,len(S)):
        if S[j] == 'A' or S[j] == 'G' or S[j] == 'T' or S[j] == 'C':
            flag +=1
            ans = max(ans,flag)
        else:
            break
        
print(ans)
s = list(input())

cnt = 0
ans = 0
check = ["A", "C", "G", "T"]

for i in range(len(s)):
    if s[i] in check:
        cnt += 1
        ans = max(cnt, ans)
    else:
        cnt = 0
        
print(ans)
S = input()
ACGT = ["A","C","G","T"]

ans = 0 
ans_lis = [0]

for i in range(len(S)):
    if S[i] in ACGT:
        ans = ans + 1 
        if i == (len(S)-1):
            ans_lis.append(ans)
    elif S[i] not in ACGT:
        ans_lis.append(ans)
        ans = 0 

print(max(ans_lis))
s = input()
count = 0
ans = 0
for i in s:
    if i in'AGCT':
        count += 1
        ans = max(ans, count)
    else:
        count = 0
print(ans)
S = list(input())
def atgc(s):
    if s == "A" or s == "T" or s == "G" or s == "C":
        return True
    else:
        return False
c = 0
nax = 0
for i in range(len(S)):
    if atgc(S[i]):
        c += 1
        if i == len(S)-1:
            nax = max(nax,c)
    else:
        nax = max(nax,c)
        c = 0
print(nax)
s = input()

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

A = 0
B = 0
for i in S:
  if "AGTC".count(i) == 1:
    B += 1
  else:
    A = max(A,B)
    B = 0
A = max(A,B)
print(A)
c,m=0,0
for i in input():
  if i in "AGCT":
    c+=1
  else:
    if c > m:
      m=c
    c=0
if c > m:
      m=c
print(m)
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))

def main():
    S = input()
    n = len(S)
    acgt = ['A', 'C', 'G', 'T']
    cnt = 0
    maxlen = 0
    for i in range(n):
        if S[i] in acgt:
            cnt += 1
            maxlen = max(maxlen, cnt)
        else:
            cnt = 0
    print(maxlen)

if __name__ == '__main__':
    main()
s=list(input())
dp = [0]*(len(s)+1)
for i in range(len(s)):
    if s[i] in 'ACGT':
        dp[i] += 1
        dp[i+1] += dp[i]
    else:
        dp[i]=0
print(max(dp))
S = input()
listS = list(S)
N = []
dic = ['A', 'T', 'G', 'C']
count = 0
for i in range(len(listS)):
    if listS[i] in dic:
        count += 1
        N.append(count)
    else:
        count = 0
        N.append(count)
print(max(N))
ss = input()
dic = {'A': 1, 'C': 1, 'G': 1, 'T': 1}
max_s = 0
tmp = 0
for s in ss:
    if s in dic.keys():
        tmp += 1
    else:
        max_s = max(max_s, tmp)
        tmp = 0
max_s = max(max_s, tmp)
print(max_s)
s=input()
x=0
y=0
for i in range(len(s)):
  if s[i] in ['A','T','C','G']:
    y+=1
    x=max(x,y)
  else:
    y=0
    
print(x)
S = input()

max_len = 0
for i in range(len(S)):
    for j in range(i, len(S)+1):
        tmp = S[i:j]
        for t in tmp:
            if t != 'A' and t != 'C' and t != 'G' and t != 'T':
                break
        else:
            if len(tmp) >= max_len:
                max_len = len(tmp)

print(max_len)
s = input()

acgt_list = ["A", "C", "G", "T"]

ans = 0
temp = 0
for c in s:
    if c in acgt_list:
        temp += 1
        continue
    ans = temp if temp > ans else ans
    temp = 0
ans = temp if temp > ans else ans
print(ans)
a=input()
ct=[0]*10
hantei=0
ct2=0
for i in a:
    if (hantei==1):
        if i in'ACGT':
            ct[ct2]+=1
        else:
            hantei=0
            ct2+=1
    else:
        if i in 'ACGT':
            ct[ct2]+=1
            hantei=1
print(max(ct))
s = input()
 
ans=0
counter = 0
for c in s:
  if c=='A' or c=='C' or c=='G' or c=='T':
    counter+=1
  else:
    ans = max(ans,counter)
    counter=0
ans = max(ans,counter)
print(ans)
S=input()
N=len(S)
ans=0
for i in range(N):
  for j in range(i,N):
    if all('ATCG'.count(a)==1 for a in S[i:j+1]):
      ans=max(ans,j+1-i)
      
print(ans)
s = input()

l,r = 0,0
ma = 0
for l in range(len(s)):
    if(s[l] not in ['A','C','G','T']):continue
    t = ""
    for r in range(l,len(s)):
        if(s[r] not in ['A','C','G','T']):break
        t += s[r]
    ma = max(ma,len(t))
print(ma)
#B
s = input()
n = len(s)
ans = 0
for i in range(n):
    for j in range(i,n):
        if all('ACGT'.count(c) == 1 for c in s[i:j+1]):
            ans = max(ans, j - i + 1)
print(ans)
S = input()
N = len(S)
ans = 0
for i in range(len(S)):
  for j in range(i, len(S)):
    A = S[i:j]
    if all('ACGT'.count(c) == 1 for c in S[i:j+1]):
      ans = max(j-i+1, ans)
        
print(ans)
a=[0]
for i in input():
 if i in "ACGT":a+=[a[-1]+1]
 else:a+=[0]
print(max(a))
s = input()
n = len(s)
x = [0] * n
fl = 1
if s[0] == 'A' or s[0] == 'T' or s[0] == 'C' or s[0] == 'G':
    x[0] = 1
        
for i in range(1,n):
    if s[i] == 'A' or s[i] == 'T' or s[i] == 'C' or s[i] == 'G':
        x[i] = x[i-1] + 1
    else:
        x[i] = 0

print(max(x))
def main():
    ans,tmp=0,0
    S=input()
    ACGT=list('ACGT')
    for s in S:
        if s in ACGT:
            tmp += 1
            ans = max(ans, tmp)
        else:
            tmp = 0
    print(ans)
main()
S = input()
l_list = ['A','C','T','G']
ans_list = str()
for i,l in enumerate(S):
  if l in l_list:
    ans_list += '1'
  else:
    ans_list += '0'
ans_list = ans_list.split('0')
print(max([len(i) for i in ans_list]))
s = input()
tar = ("A","C","G","T")
ans = 0
cnt = 0
for c in s:
    if c in tar: cnt += 1
    else:
        ans = max(cnt,ans)
        cnt = 0
else: ans = max(cnt,ans)
print(ans)
s = list(input())
right = 0
ans = 0
for left in range(len(s)):
    while right < len(s) and s[right] in ["A", "C", "G", "T"]:
        right += 1
    ans = max(ans, right - left)
    right = left + 1
print(ans)
S = input().strip()
popa = list("ACGT")
maxx = 0
counter = 0
for i in S:
  if i in popa:
    counter+=1
  else:
    maxx = max(maxx,counter)
    counter = 0
maxx = max(maxx,counter)
print(maxx)
s=input()

acgt=["A","C","G","T"]

ans=-1
cnt=0
for i in range(len(s)):
        if s[i] in acgt:
                cnt+=1
        else:
                if ans < cnt:
                        ans=cnt
                cnt=0
if ans < cnt:
        ans=cnt
print(ans)
S=str(input())
ans=0
kotae=[]
for i in range(len(S)):
    if S[i] in "ACGT":
        ans+=1
        kotae.append(ans)
    else:
        ans=0
        kotae.append(ans)
print(max(kotae))
s = input()

ans = 0
for i in range(len(s)):
    for j in range(i + 1, len(s) + 1):
        cnt = 0
        for k in ["A", "G", "C", "T"]:
            cnt += s[i:j].count(k)
        if cnt == len(s[i:j]):
            ans = max(ans, cnt)

print(ans)
s = input()
ary1 = "".join([x if x in ["A","C","G","T"] else " " for x in s]).split()
if ary1 ==[]:
  print(0)
else:  
  print(max([len(x) for x in ary1]))
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 31 09:40:38 2020

@author: black
"""


S = list(input())

len = 0
ans = 0
for i in S:
    if i == "A" or i == "T" or i == "C" or i == "G":
        len += 1
        ans = max(len, ans)
    else:
        len = 0
print(ans)
S = input()

ans = 0
j = 0
for i in S:
    if i == "A" or i == "C" or i == "G" or i == "T":
        j += 1
        if ans < j:
            ans = j
    else:
        j = 0

print(ans)
S = input() 
ans = 0
cnt = 0
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: cnt = 0
    if(cnt > ans): ans = cnt
print(ans)
def resolve():

    S = input()
    ans = 0
    ACGT = {"A", "C", "G", "T",}

    for i in range(len(S)):
        ss = S[i:]
        cnt = 0
        for s in ss:
            if s in ACGT:
                cnt += 1
            else:
                break
        ans = max(ans, cnt)
    return print(ans)
if __name__ == "__main__":
    resolve()
s=input()

ans=0
memory=0

for i in range(len(s)):
    if s[i]=="A" or s[i]=="T" or s[i]=="G" or s[i]=="C":
        memory+=1
    else:
        ans=max(ans,memory)
        memory=0

ans=max(ans,memory)
        
print(ans)
s=input()+'Z'

ans=0
t_ans=0
for i in range(len(s)):
  if s[i] in 'ATGC':
    t_ans+=1
  else:
    ans=max(t_ans,ans)
    t_ans=0
print(ans)
def resolve():
    S = input()
    ansmax = 0
    anstmp = 0
    for i in S:
        if i == "A" or i == "T" or i == "G" or i == "C":
            anstmp = anstmp + 1 
            ansmax = max(ansmax,anstmp)
        else: 
            ansmax = max(ansmax,anstmp)
            anstmp = 0
    print(ansmax)
resolve()
s = input()
m=[]
t = 0
for i in list(s):
  if i == 'A' or i == 'C' or i == 'G' or i == 'T':
     t += 1
  else:
     t = 0
  m.append(t)

print(max(m))
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7

s=input()
ans=0
lst=["A","C","G","T"]
for i in range(len(s)):
    tmp=0
    for j in range(i,len(s)):
        if not s[j] in lst:
            break
        else:
            tmp+=1
    ans=max(ans,tmp)
print(ans)
s = input()
ans = 0
for l in range(len(s)):
    for r in range(l+1, len(s)+1):
        substr = s[l:r]
        if set(substr).issubset({"A", "C", "G", "T"}):
            ans = max(ans, len(substr))
print(ans)
S = input()
mx = 0
count = 0
for x in S :
    if x in "ATGC" :
        count += 1
    else :
        mx = max(mx, count)
        count = 0
mx = max(mx, count)
print(mx)
S = str(input())
count = 0
ans = 0
for i in range(len(S)):
  if S[i] in "ACGT":
    count += 1
    ans =  max(ans,count)
  else:
    count = 0
print(ans)
cnt, ans = 0, 0
s = input()
for i in s:
    if i in ["A", "C", "G", "T"]:
        cnt += 1
    else:
        ans = max(ans, cnt)
        cnt = 0
if cnt > 0:
    ans = max(ans, cnt)
print(ans)
s=input()
l=len(s)

res=0
cnt=0

for i in range(l):
	t=s[i]
	if t=="A" or t=="T" or t=="C" or t=="G":
		cnt+=1
	else:
		res=max(res,cnt)
		cnt=0

res=max(res,cnt)
print(res)
import sys
input = sys.stdin.readline

S = input().rstrip('\r\n')
ans = 0
count = 0
for s in S:
    if s == 'A' or s == 'C' or s == 'G' or s == 'T':
        count += 1
    else:
        ans = max(ans, count)
        count = 0
ans = max(ans, count)
print(ans)
s=input()
n=len(s)
List="ACGT"
count=0
ans=0
flag=0
for i in range(n):
    if (List.count(s[i])>0):
        count+=1
        ans=max(ans,count)
    else:
        count=0
print(ans)
import numpy as np
import sys

input = sys.stdin.readline

S = input()

cnt = 0
acgt = ['A','C','G','T']

x = []
for i in range(len(S)):
    if S[i] in acgt:
        x.append(True)
    else:
        x.append(False)

ans = 0
cnt = 0
for i in x:
    if i :
        cnt+=1
    else:
        ans = max(ans,cnt)
        cnt = 0

print(ans)
import sys
input = sys.stdin.readline


def check(T, usable: set):
    for t in T:
        if t not in usable:
            return 0
    return len(T)


def main():
    S = input().rstrip("\n")
    usable = {"A", "C", "G", "T"}
    candidates = []
    for i in range(len(S)):
        for j in range(i, len(S)):
            T = S[i:j+1]
            res = check(T, usable)
            candidates.append(res)

    print(max(candidates))


if __name__ == "__main__":
    main()
s = input()
n = len(s)
dna = ["A", "C", "G", "T"]
ans = 0
counter = 0
for i in range(n):
  if s[i] in dna:
    counter += 1
  else:
    ans = max(ans, counter)
    counter = 0
ans = max(ans, counter)

print(ans)
S = input()
T = set({'A', 'T', 'C', 'G'})

ans = 0
for l in range(len(S)):
    for r in range(l + 1, len(S) + 1):
        if set(S[l:r]) <= T:
            ans = max(ans, r - l)
print(ans)
def resolve():
    s=input()
    cnt=0
    ans=0
    for i in s:
        if i in ['A','T','C','G']:
            cnt+=1
            ans=max(ans,cnt)
        else:
            cnt=0
    print(ans)
resolve()
def S(): return input()
S = S()
dp = [0]*(len(S)+1)
for i,x in enumerate(S,1):
    if x in 'ACGT':
        dp[i] = dp[i-1]+1
print(max(dp))
s = input()

d = len(s)
ans = [0] * 10
tmp = 0
for i in range(d):
    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
        ans[tmp] += 1
    else:
        tmp += 1
print(max(ans))
s=input()

ans = 0
for i in range(len(s)):
    for j in range(i+1,len(s)+1):
        if s[i:j].count("A")+s[i:j].count("C")+s[i:j].count("G")+s[i:j].count("T")==j-i:
            ans = max(ans,j-i)
print(ans)
"""
author : halo2halo
date : 9, Jan, 2020
"""

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

AT = {'A', 'C', 'G', 'T'}
S = list(read().decode('utf8').rstrip())

lis = [0] * len(S)
for s in range(len(S)):
    if S[s] in AT:
        if lis[s - 1] != 0:
            lis[s] += lis[s - 1] + 1
        else:
            lis[s] = 1
    else:
        lis[s] = 0

print(max(lis))
S = input()
N = len(S)
ans = 0
for i in range(N):
  for j in range(i, N):
    if all('ACGT'.count(c) ==  1 for c in S[i : j + 1]):
      ans = max(ans, j - i + 1)
      
print(ans)
S=list(input())
tmp=0
ans=0
ACGT=['A','C','G','T']
for i in range(len(S)):
  if S[i] in ACGT:
    tmp+=1
  else:
    ans=max(ans,tmp)
    tmp=0
ans=max(ans,tmp)
print(ans)
def main():
    s = input()
    ans = 0
    seq = 0
    for c in s:
        if c == 'A' or c == 'C' or c == 'T' or c == 'G':
            seq+=1
        else:
            ans = max(ans,seq)
            seq=0
    else:
        ans = max(ans,seq)
    print(ans)

if __name__ == '__main__':
    main()
S = input()
m = 0
count = 0
for s in S:
    if s in 'ACGT':
        count += 1
    else:
        count = 0
    m = max(m, count)
print(m)
# 各桁の数値の総和を計算する.
def calc_digit_sum(num):
    sums = 0
    while num > 0:
        sums += num % 10
        num //= 10
    return sums


s = input()
contains = set(["A", "C", "G", "T"])

answer = cnt = 0
for ch in s:
    if ch not in contains:
        cnt = 0
    else:
        cnt += 1
    answer = max(answer, cnt)

print(answer)
s = input()
most = 0
acgt = ["A", "C", "G", "T"]
point = 0
for i in range(len(s)):
    if s[i] in acgt:
        point += 1
    else:
        if point > most:
            most = point
        point = 0
if point > most:
    most = point
point = 0
print(most)
S = input()
result = 0
for i in range(len(S)):
  checker = 0
  if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
    checker += 1
    for j in range(i+1,len(S)):
      if S[j] == "A" or S[j] == "C" or S[j] == "G" or S[j] == "T":
        checker += 1
      else:
        break
  result = max(result,checker)
print(result)
A = list(input())
max_nu = 0 
nu = 0
for i in range(len(A)):
    if A[i] == "A" or A[i] == "C" or A[i] == "G" or A[i] == "T":
        nu += 1
        if max_nu < nu:
            max_nu = nu
    else:
        nu = 0
print(max_nu)
S = input()
n = len(S)
acgt = ['A', 'C', 'G', 'T']
ans = cnt = 0
for s in S:
    if s in acgt:
        cnt += 1
        ans = max(ans, cnt)
    else:
        cnt = 0
print(ans)
S=input()
acgt=['A','C','G','T']
ans,count=0,0

for i in range(len(S)):
    if S[i] in acgt:
        count+=1
        ans=max(ans,count)
    else:
        count=0

print(ans)
S = input()

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

count = 0
max_count = 0
for s in S:
    if s in ACGT:
        count += 1
    else:
        max_count = max(max_count, count)
        count = 0
max_count = max(max_count, count)
print(max_count)
s = input()
acgt = set({'A','C','G','T'})
s = s + 'Z' #dummy
ans = [-1]*(len(s))
def dfs(i):
    if ans[i] != -1:
        return ans[i]
    elif s[i] not in acgt:
        ans[i] = 0
        return 0
    else:
        ans[i] = dfs(i+1) + 1
        return ans[i]
for i in range(len(s)):
    dfs(i)
print(max(ans))
s=input()
n=len(s)
list=['A','C','G','T']
ans=[]
for i in range(n):
  k=0
  while i+k<=n-1:
    if all(a in list for a in s[i:i+k+1]):
      ans.append(k+1)
    k+=1
if len(ans)==0:
  print(0)
else:
  print(max(ans))
#ABC122B - ATCoder
s = str(input())
size = len(s)
ans = 0
for i in range (0,size):
    for j in range (i,size+1):
        hantei = s[i:j]
        countA = hantei.count('A')
        countC = hantei.count('C')
        countG = hantei.count('G')
        countT = hantei.count('T')
        if (len(hantei) == countA + countC + countG + countT):
            if(ans < len(hantei)):
                ans = len(hantei)
print(ans)
def solve():
    s = input()
    ans = ''
    for i in range(len(s)+1):
        for j in range(i+1, len(s)+1):
            if s[i:j].replace('A', '').replace('C', '').replace('G', '').replace('T', '') == '':
                if len(ans) < len(s[i:j]):
                    ans = s[i:j]
    print(len(ans))


if __name__ == '__main__':
    solve()
#122_B
S=input()
Ans=0
cnt=0
for s in S:
    if s in 'ATCG':
        cnt+=1
    else:
        Ans=max(Ans,cnt)
        cnt=0
Ans=max(Ans,cnt)
print(Ans)
icase=0
if icase==0:
    s=list(input())
    acgt={"A","C","G","T"}
    sc=[0]*len(s)
    if s[0] in acgt:
        sc[0]=1
    for i in range(1,len(s)):
        if s[i] in acgt:
            sc[i]=sc[i-1]+1
    print(max(sc))
s = input()
ans = 0
m = 0
for S in s:
  if S in "A":
    ans += 1
  elif S in "G":
    ans += 1
  elif S in "T":
    ans += 1
  elif S in "C":
    ans += 1
  else:
    ans = 0
  m = max(m,ans)
print(m)
import re

S = re.findall('[ACGT]*', input())
print(max([len(s) for s in S]))
S=str(input())
S=S.translate(str.maketrans({'A': 'a', 'T': 'a', 'C': 'a','G': 'a'}))

if "a" in S:
    l=len(S)
    for i in range(1,l+1):
        b=S.count(str("a"*i))
        if b == 0:
            print(i-1)
            break
        if i==l:
            print(l)
else:
    print("0")
#conding utf-8
S=input()
ATGC=["A","T","G","C"]
ans=0
tmp=0
for i in range(len(S)):
  if S[i:i+1] in ATGC:
    tmp +=1
  else:
    tmp=0
  if ans<tmp:
    ans=tmp

print(ans)
S=input()
ACGT=[0]
count=0
for i in range(len(S)):
    if (S[i]=="A")|(S[i]=="C")|(S[i]=="G")|(S[i]=="T"):
        count+=1
    else:
        ACGT.append(count)
        count=0
ACGT.append(count)
print(max(ACGT))
s = input()
acgt = 'ACGT'

acgt_flag = False
length = 0
l = 0

for i in range(len(s)):
  if s[i] in acgt:
    if acgt_flag:
      l+=1
    else:
      l=1
      acgt_flag = True
  else:
    if acgt_flag:
      length = max(length, l)
      acgt_flag = False

length = max(length, l)
print(length)
S = input()
ans = 0
long= 0
ACGT = ['A','C','G','T']
for s in S:
  if s in ACGT:
    long += 1
    ans = max(ans,long)
  else:
    long = 0
print(ans)
S = list(input())
L = ['A','C','G','T']
c = 0
ans = 0

for i in S:
    if i in L:
        c += 1
        ans = max(ans,c)
    else:
        c = 0

print(ans)
s = input()
ACGT = "ACGT"
cnt = 0
ans = 0

for i in s:
    if i in ACGT:
        cnt += 1
    else:
        ans = max(ans, cnt)
        cnt = 0

print(max(ans, cnt))
import bisect,collections,copy,heapq,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

s = S()
cnt = 0
max_reg = 0
for x in s:
    if 'A' in x or 'C' in x or 'G' in x or 'T' in x:
        cnt += 1
    else:
        max_reg = max(max_reg,cnt)
        cnt = 0
max_reg = max(max_reg,cnt)
print(max_reg)
s = list(input())
n = len(s)

def atcg(s):
    slength = len(s)
    cnt = 0
    for i in range(slength):
        if s[i] == 'A' or s[i] == 'T' or s[i] == 'C' or s[i] == 'G':
            cnt +=1
        else:
            break
    return cnt

ans = []
for i in range(n):
    ans.append(atcg(s[i:]))


print(max(ans))
S = input()

d = set(['A', 'T', 'C', 'G'])
len_ = 0
ans = 0
for s in S:
    if s in d:
        len_ += 1
    else:
        if len_ > ans:
            ans = len_
        len_ = 0
if len_ > ans:
    ans = len_
print(ans)
S = input()
acgt = ['A', 'C', 'G', 'T']


flag = False
best = 0
a = 0

for s in S:
    if s in acgt:
        if flag:
            a += 1
        else:
            a = 1
            flag = True
        if a > best:
            best = a
    else:
        if flag:
            flag = False
print(best)
import re

s = input()
l = [len(s) for s in re.findall(r'[ACGT]+', s)]
print(0 if len(l) == 0 else max(l))
s = str(input())
s += "B"
l = len(s)
c = 0
mx = 0
for i in range(l):
  if s[i] in ["A","G","C","T"]:
    c += 1
  else:
    if c > mx:
      mx = c
      c = 0
    else:
      c = 0
print(mx)
s = input()
SENT = ('A','T','G','C')

ans = 0
count = 0
for c in s:
  if c in SENT:
    count += 1
  else:
    ans = max(ans,count)
    count = 0
else:
  ans = max(ans,count)
  
print(ans)
import re
S = input()
match = re.findall("[ACGT]*", S)
print(max(map(len, match)))
input = input()
num = 0
max = 0
for j in range(len(input)):
    i = input[j]
    if i == "A" or i == "T" or i == "C" or i == "G":
        num += 1
        max = num if num > max else max
    else: 
        num = 0
print(max)
S = input()
n = len(S)

flag = 0
for i in reversed(range(0,n+1)):
  for j in range(0,n-i+1):
    s = S[j:j+i].replace("A", "").replace("C", "").replace("G","").replace("T","")
    #print("+", s, "+", len(s))
    if len(s) == 0:
      flag=1
      break
  if flag==1:
    break

print(i)
from itertools import combinations
import sys


def get_ngram(n, s):
    return [''.join(s[i:i+n]) for i in range(len(s)-n+1)]


def main():
    S = input()
    chars = {'A', 'C', 'G', 'T'}

    for i in range(len(S), -1, -1):
        for c in get_ngram(i, S):
            if set(c) <= chars:
                print(i)
                sys.exit()


if __name__ == "__main__":
    main()
S = input()
ans = 0
cnt = 0
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:
    cnt = 0
  ans = max(ans, cnt)
print(ans)
l = ["A","T","G","C"]
cnt = []
s = input()
c = 0
flag = 0
for i in range(len(s)):
  if s[i] not in l:
    cnt.append(c)
    c = 0
  else:
    c += 1
cnt.append(c)
print(max(cnt))
import copy

S = list(input())
tmp = 0
count = 0

for s in S:
    if s == 'A' or s == 'C' or s == 'G' or s == 'T':
        tmp += 1
        if count < tmp:
            count = copy.copy(tmp)
    else:
        tmp = 0

print(count)
s = list(input())

s.append(" ")

current = 0
ans = 0
for i in range(len(s)):
    if s[i] not in "ACGT":
        ans = max(ans, i-current)
        current = i+1

print(ans)
S=input()
L=["A","C","G","T"]
cnt=0
ans=0
for i in range(len(S)):
    if S[i] in L:
        cnt+=1
        ans=max(ans,cnt)
    else:
        cnt=0
    
print(ans)
n = input()
cnt = 0
ans = 0
for i in range(len(n)):
    if n[i] in "ACGT":
        cnt += 1
        if ans <= cnt:
            ans = cnt
    else:
        cnt = 0
print(ans)