peterverebics/CodeNet_Python_118 huggingface dataset:
S = list(input())
ls = len(S)
ans = 0
now = 0
for i in range(ls):
    if S[i] in {"A", "C", "G", "T"}:
        now += 1
    else:
        ans = max(ans, now)
        now = 0
print(ans)
import re
s = input()

ans = ""
tmp_ans = ""
for i in range(len(s)):
    if re.fullmatch(r"[ATGC]", s[i]):
        tmp_ans += s[i]
    else:
        if len(ans) < len(tmp_ans):
            ans = tmp_ans
        tmp_ans = ""

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

for i in range(len(S)):
  if S[i] != "A" and S[i] != "C" and S[i] != "G" and S[i] != "T":
    max = count
    count = 0
  if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
    count += 1
    
  print(i,count)
  if max > ans:
    ans = max
print(ans)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    S = input()
    result = 0
    for i in range(len(S)):
        for j in range(len(S)):
            if len(set(list(S[i:j])) - set(['A', 'C', 'G', 'T'])) == 0:
                if result < len(list(S[i:j])):
                    result = len(list(S[i:j]))
    print(result)


if __name__ == "__main__":
    main()
S = list(input())
P = set(["A","C","T","G"])
count = 0
if P&set(S) == set():
  print(0)
  exit()
else:
  for i in range(0,len(S)-1):
    for j in range(i+1, len(S)):
      if set(S[i:j])-P == set():
        count = max(count,j-i)
        
print(count)
s = input()
res, ans = 0, 0
for i in s:
    if i == "A" or i == "C" or i == "G" or i == "T":
        res += 1
    else:
        ans = max(res, ans)
        res = 0
print(ans)
S = input()

l = []

for i in range(0,len(S)):
    if(S[i] == 'A' or S[i] == 'G' or S[i] == 'C' or S[i] == 'T'):
        l.append(i)
        
##print(l)
if(len(l) == 0):
    print(0)
else:   
    count = 1
    max = 1

    for i in range(0,len(l)-1):
        if(l[i]+1 == l[i+1]):
            count += 1
            max = count
        else:
            max = count
            count = 1
    print(max)
s = input()
lst = ["A", "C", "G", "T"]
flag = 0
cnt = 0
cnt_lst = []

for i in s:
    if flag:
        if i not in lst:
            cnt_lst.append(cnt)
            flag = 0
            cnt = 0
        else:
            cnt += 1
    else:
        if i in lst:
            flag = 1
            cnt += 1

print(max(cnt_lst)) if cnt_lst else print(0)
S = input()

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

print(ans)
# -*- coding: utf-8 -*-
s = input()
max_length=0
length=0
for c in s:
    if c in 'AGCT':
        length+=1
    else:
        max_length=max(max_length, length)
        length=0
print(max_length)
S=input()
ACGT=["A","C","G","T"]
ans=0
count=0
for x in S:
  if x in ACGT:
    count+=1
  else:
    ans=max(ans,count)
    count=0
print(ans)
S=str(input())
lst=['A','C','G','T']
cnt=0

for s in S:
    if s in lst:
        cnt+=1

print(cnt)
def main():
    # n = int(input())
    # n, m = map(int, input().split())
    # a = list(map(int, input().split()))
    s = input()
    # h = [int(input()) for _ in rane(n)]
    count = 0
    maxi = 0
    for string in s:
        if string == "A" or string == "C" or string == "G" or string == "T":
            count += 1
        else:
            maxi= max(count, maxi)

    print(maxi)


if __name__ == '__main__':
    main()
s = list(input())
cnt,ans = 0,[]
agct = ["A","G","C","T"]
for i in range(len(s)):
    if s[i] in agct:
        cnt += 1
    else:
        ans.append(cnt)
        cnt = 0
if ans == []:
    ans.append(0)
for j in ans:
  if j == 1:
    j = 0
print(max(ans))
s = input()
possible_answers = [0]
possible_answer = 0
acgt = ['A', 'C', 'G', 'T']

for i in range(len(s)):
    if s[i] in acgt:
        possible_answer += 1
    else:
        possible_answers.append(possible_answer)
        possible_answer = 0

print(max(possible_answers))
import re
s=input()
ans=re.findall(r"((A|T|G|C)+)",s)#先に(が手てくる方から行列が形成される。
if ans==[]:#リストではなくてタプルなので注意・
    print(0)
else:
    print(len(max(ans[0],key=len)))
a=str(input())
count=0
ans=0
for i in range(len(a)):
    if a[i]== "A" or a[i]== "C" or a[i]== "G" or a[i]== "T" :
        count+=1
    else:
        ans=max(ans,count)

print(ans)
s=input()
ans=0
for i in range(len(s)-1):
    for j in range(i,len(s)):
        if s[i:j].count("A")+s[i:j].count("T")+s[i:j].count("C")+s[i:j].count("G")==len(s[i:j]):
            ans=max(ans,len(s[i:j]))
print(ans)
s=input()
cnt=0
temp=0
for i in s:
    if i in 'ATGC':
        temp+=1
        continue
    if cnt<temp:cnt=temp
    temp=0

print(cnt)
S=input()
N=len(S)
ans=0
d=set(list("AGCT"))

for i in range(N+1):
    for j in range(N+1):
        s=S[i:j]
        print(s)
        if set(list(s))<=d:
            ans=max(ans,len(s))
            
print(ans)
S = input()

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

ans = 0
ok = False
tmp = 0
for s in S:
    if not ok:
        if s in acgt:
            ok = True
            tmp += 1
        else:
            pass
    elif ok:
        if s in acgt:
            tmp += 1
        else:
            ok = False
            ans = max(tmp,ans)
            tmp = 0
print(ans)
S = str(input())
ans = 0
for i in range(len(S)):
    count = 0
    fr = 0
    if S[i] == "A" or "T" or "C" or "G":
        count += 1
        for j in range(i+1, len(S)):
            if fr == 0 and S[j] == "A"  or  S[j] == "T"  or  S[j] == "C"  or  S[j] == "G":  
                count += 1
            else:
                fr += 1
    if ans < count:
        ans = count
print(ans)
s = input()

mx  = 0
n = len(s)
kensa = ["A", "C", "G", "T"]

for i in range(n):
    for j in range(i,n-1):
        mj = s[i:j+1]
        bl = True
        for l in range(len(mj)):
            if mj[l] not in kensa:
                bl = False
                break
        if bl and mx<len(mj):
           mx = len(mj)

print(mx)
b = input()

base_pairs = {
    'A': 'T', 
    'C': 'G',
    'G': 'C',
    'T': 'A',
}

pair = base_pairs.get(b)

print(pair)
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
print(ans)
pattern = ["A", "T", "G", "C"]

s = input()

max_count = 0
count = 0
for c in s:
    if s in pattern:
        count += 1
    else:
        max_count = max(count, max_count)
        count = 0
max_count = max(count, max_count)
print(max_count)
S = input()

cnt = 0
mcnt = 0
for i in S:
    if i == 'A' or i == 'C' or i == 'G' or i == 'T':
        cnt += 1
        mcnt = max(mcnt,cnt)

print(mcnt)
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)
print(maxx)
import string
str_up = string.ascii_uppercase.replace("A","").replace("C","").replace("G","").replace("T","")
S = input()
part = []
for i in range(len(S)):
    for j in range(len(S)-i+1):
        part.append(S[i:i+j])
max_s = 0
print(part)
for i in part:
    for j in str_up:
        if j in i:
            break
        elif j == "Z":
            if len(i) > max_s:
                max_s = len(i)
print(max_s)
S = input()
m = 0
for i in range(len(S)):
  for j in range(i, len(S)):
    if S[j] not in ["A", "C", "G", "T"]:
      m = max(m, j-i)
      break
print(m)
S = input()

ans = 0
for s in S:
  if s in ["A", "C", "G", "T"]:
    ans += 1
    
print(ans)
s = input()
ans = 0
leng = 0
t = ('A','C','G','T')

for i in range(len(s)):
	if s[i] in t:
		leng += 1
	else:
		ans = max(ans,leng)
		leng = 0
print(ans)
s = input()

ans = 0

for l in range (len(s)-1):

  for r in range(l+1, len(s)+1):

    cnt = 0

    for str in s[l:r]:

      if str not in ['A','C','G','T']:

        cnt = 0 

        break

      else:

        cnt += 1

    ans = max(ans, cnt)

print(ans)
b=list(str(input()))
E={"A":"T","T":"A","C":"G","G":"C"}
count=0
ans=0
for moji in b:
	if moji in E:
		count+=1
	else:
		ans=max(ans,count)
		count=0
print(ans)
S = list(input())

ans = 0
ans_ = 0
for s in S:
    if s=="A" or s=="C" or s=="G" or s=="T":
        ans_ += 1
    else:
        if ans < ans_:
            ans = ans_
            ans_ = 0
print(ans)
S = input()
n = len(S)
ans = 0
flag = True
for i in range(n):
  for j in range(i):
    for k in range(i,n):
      S_part = S[j:k+1]
      for s in S_part:
        if not s in "ACGT":
          flag = False
      if flag:
        ans = max(ans,len(S_part))
      flag = True
print(ans)
S = input()
l = len(S)
count=0
ans= 0
for i in range(l):
  if S[i] in ["A" ,"C" ,"G","T"]:
    count +=1
  ans = max(count,ans)
print(ans)
S = input()

Count = [0 for _ in range(len(S))]
count = 0
reset = 1
for i, s in enumerate(S):
    if s in 'ACGT':
        if reset == 0:
            count += 1
            Count[i] = count
            reset = 0
        else:
            count += 1
            Count[i] = 1
            reset = 0
    else:
        reset = 1
print(max(Count))
import sys
input = lambda: sys.stdin.readline().rstrip() 

def resolve():
    S = input()
    acgt = ['A', 'C', 'G', 'T']
    ans = 0
    l = 0
    while (l < len(S)-1) and (len(S)-l > ans):
        r = l+1
        while (r < len(S)+1) and (S[r-1] in acgt):
            r += 1
        ans = max(r-1-l, ans)
        l += 1

    print(ans)

if __name__ == '__main__':
    resolve()
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
else:
  print("0")
print(len(input().replace("A","").replace("G","").replace("C","").replace("T","")))
s=input()
#for i in range(len(s),0,-1):
#    for j in range(0,len(s)-i+1):
#        #print(j,i+j)
#        s1=s[j:i+j:]
m=0
s1=""
for x in s:
    if x=='A' or x=='G' or x=='T' or x=='C':
        s1+=x
    else:
        m=max(m,len(s1))
        s1=""
print(m)
s = input().strip()
ans = 0
rep = 0
for c in s:
    if c == 'A' or c == 'G' or c == 'C' or c == 'T':
        rep += 1
    else:
        ans = max(ans, rep)
        rep = 0
print(ans)
def ATCoder(S):
    count = 0
    res = 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:
            if count > res:
                res = count
            count = 0
    return res



if __name__ == "__main__":
    S = str(input())
    print(ATCoder(S))
S = input()
L = len(S)
ans = 0
for i in range(L-1):
    c = 0
    for s in S[i:]:
        if s in ['A', 'C', 'G', 'T']:
            c += 1
        else:
            break
    ans = max(ans, c)

print(ans)
S = input()

max = 0
for i in range(len(S)-1):
    for j in range(i+1, len(S)+1):
        count = 0
        print(S[i:j])
        for char in S[i:j]:
            if char == 'A' or char == 'C' or char == 'G' or char == 'T':
                count += 1
            else:
                count = 0
                break
        if count > max:
            max = count

print(max)
s = input()
ans = 0
for i in range(len(s)):
    for j in range(i,len(s)):
        cur = s[i:j]
        for val in cur:
            if val not in ('A','C','G','T'):
                break
        else:
            ans = max(ans,len(cur))

print(ans)
S = input()
ans = 0
temp = 0
for i in range(len(S)):
    if S[i] == 'A' or S[i] == 'C' or S[i] == 'G' or S[i] == 'T':
        temp += 1
    else:
        if ans < temp:
            ans = temp
            temp = 0
        else:
            temp = 0

if temp == len(S):
    ans = temp
print(ans)
s=input()
gene = ["A","T","G","C"]
ans=0
counter=0
for i in range(len(s)):
	for j in range(i,len(s)):
		if(s[j] in gene):
			counter += 1
		else:
			if(counter > ans):
				ans=counter
			counter=0
			break
	counter=0
print(ans)
s = input()
ans = 0
lis = []

for a in s:
  if a == "A" or a == "T" or a == "C" or a == "G":
    ans += 1
  else:
    lis.append(ans)
    ans = 0

print(lis)
S = input()
S = list(S)

str_max = 0
#print(len(S))
for start in range(len(S)):
    for end in range(start+1, len(S)):
        if {"A","C","G", "T"} |set(S[start:end+1]) == {"A","C","G", "T" }:
            str_max = max(str_max, -start+end+1)

print(str_max)
S=input()

l=0
for i in range(len(S)-1):
  for j in range(i+1,len(S)):
    s = set(S[i:j])
    if s <= {'A','C','G','T'} and len(S[i:j])>l:
      l = len(S[i:j])
      
print(l)
s=input()
temp=0
ans=0
tar="ACGT"
for ch in s:
  if ch in tar:
    temp+=1
  else:
    if ans<temp:
      ans=temp
    temp=0


print(ans)
s = input()
acgt = ['A','C','G','T']
i = 0
max = 0
count = 0

while i < len(s):
    if s[i] in acgt:
        count+=1
    else:
        if count > max:
            max = count
        count = 0
    i+=1

print(max)
s = input()
ans = 0
count = 0
for i in range(len(s)):
	if s[i] in "ACGT":
		count += 1
	else:
		ans = max(ans, count)
print(ans)
def main():

    s = input()
    l = ['A', 'G', 'T', 'C']
    ans = 0
    for j in range(len(s)):
        cnt = 0
        for i in range(j, len(s)):
            if s[i] in l:
                cnt += 1
            else:
                ans = max(ans, cnt)
                break
    print(ans)


if __name__ == '__main__':
    main()
l=input()

if "A" or "G" or "C" or "T" not in l:
  print(0)
  exit()

ans=0
num=0
for i in l:
  if i=="A" or i=="G" or i=="C" or i=="T":
    num+=1
  else:
    ans=max(num,ans)
    num=0
    
print(ans)
#!/usr/bin/env python3
# https://atcoder.jp/contests/abc122/tasks/abc122_b

import re
s = input()
m = re.search(r"([ACGT]+)", s)
if m:
    print(len(m.group(1)))
else:
    print(0)
S = input()
RES = 0

def countACGT(s):
  res = 0
  res += s.count("A")
  res += s.count("C")
  res += s.count("G")
  res += s.count("T")
  return res

for i in range(len(S)+1):
  for j in range(len(S)+1):
    RES = max(RES,countACGT(S[i:j]))
print(RES)
s=input()
S=[s[i] for i in range(len(s))]
A={'A','C','G','T'}
B=[S[i] in A for i in range(len(S))]
max_length=0

for i in range(len(B)):
  if B[i]==1:
    count_length=1
    count=i
    while (count+1)<len(B) and B[count+1]==1:
      count_length=1+count_length
      count=1+count
      max_length=max(max_length,count_length)
      
print(max_length)
S = input()

src = ["A","T","C","G"]
ok = True
ans = 0
tmp = 0
for s in S:
    if s in src:
        tmp += 1
        ok = True
    else:
        ok = False
        ans = max(ans, tmp)
        tmp = 0
        continue

print(ans)
#!/usr/bin/env python3
def main():
    S = input()

    lst = set(['A', 'C', 'G', 'T'])
    cnt = 0
    ans = 0
    for s in S:
        if s in lst:
            cnt += 1
        else:
            ans = max(ans, cnt)
            cnt = 0
    print(ans)


if __name__ == '__main__':
    main()
S = input()

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

start = 0
ans = 0
def answer(start):
    count = 0
    for i in range(start, len(S)):
        global ans
        if S[i] in ACTG:
            count += 1
        else:
            ans = max(ans, count)
            start += 1
            answer(start)
            break
answer(start)
print(ans)
s=input()

ans = 0
for i in range(len(s)):
    for j in range(i+1,len(s)):
        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)
s=list(input())
n=len(s)
ans=[]
for i in range(n-1):
  for j in range(i+1,n+1):
    part=set(s[i:j])
    flag=True
    for p in part:
      if p not in list('ATGC'):
        flag=False
        break
    if flag==True:
      ans.append(len(s[i:j]))
print(ans)
if ans:
  print(max(ans))
else:
  print(0)
s = list(input())
count = []
count.append(0)
x = ["A","T","G","C"]
c = 0
for i in range(len(s)):
    if (s[i] in x) == True:
        c += 1
    else:
        count.append(c)
        c = 0
count.append(c)
print(count)
S = input()
AGCT = ['A', 'G', 'C', 'T']
max_cnt = 0
cnt = 0
for s in S:
    if s in AGCT:
        cnt += 1
    else:
        max_cnt = max(cnt, max_cnt)
        cnt = 0

print(max_cnt)
S = input()
Max = 0
t = 0
for i in range(len(S)):
    if(S[i] == 'A')or(S[i]=='C')or(S[i]=='G')or(S[i]=='T'):
        k=i
        while k<len(S):
            if(S[k] not in ['A','C','G','T']):
                ans = k-i
                if(ans > Max):
                    Max = ans
                break
            k+=1
print(Max)
ok='AGCT'
s=list(input())
cnt=0
ans=0
for si in s:
  if si in ok:
    cnt+=1
  else:
    ans = max(ans,cnt)
print(ans)
# ABC122 B - ATCoder

S=str(input())
AC = 'ATGC'
N = []
count=0
for i in range(len(S)):
    if S[i] not in AC:
        N.append(i)
    else:
        count+=1
if count == len(S):
    print(count)
    exit()

M = N[0]
print(N)
for j in range(len(N)-1):
    M = max( N[j+1] - N[j]-1,M)
print(M)
s=list(input())

l=[]
cnt=0

for i in s:
  if i=='A' or i=='C' or i=='G' or i=='T':
    cnt+=1
  else:
    if cnt!=0:
      l.append(cnt)
      cnt=0

if not l:
  print('0')
else:
  print(max(l))
s = input()
res = 0
cnt = 0
for i in range(len(s)):
    if s[i] in 'ATGC':cnt += 1
    else:
        res = max(res, cnt)
        cnt = 0
print(res)
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 
        else: 
            ansmax = max(ansmax,anstmp)
            anstmp = 0
    print(ansmax)
resolve()
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
print(ans)
S = input()
ACGT = ['A','C','G','T']
anss = []
for i in range(len(S)):
    tmp_s = ""
    if S[i] in ACGT:
        tmp_s += S[i]
        for j in range(i+1,len(S)-i):
            if S[j] in ACGT:
                tmp_s += S[j]
            else:
                break
    anss.append([len(tmp_s),tmp_s])
anss.sort()
print(anss[-1][1])
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

se = {'A', 'C', 'G', 'T'}
S = sr()
cand = []
answer = []
for s in S:
    if s in se:
        cand.append(s)
    else:
        if len(cand) > len(answer):
            answer = cand
        cand = []

print(len(answer))
s = list(input())
l = len(s)
a=0
for i in range(l-1):
  if s[i]=='A' or s[i]=='C' or s[i]=='G' or s[i]=='T':
    if s[i+1]=='A' or s[i+1]=='C' or s[i+1]=='G' or s[i+1]=='T':
      a+=1

if a==0:
  print(0)
else:
  print(a+1)
T=input()
d=["A","T","G","C"]
ans=0
pre=0
for x in T:
  if x in d:
    pre+=1
  else:
    ans=(max(ans,pre))
    pre=0
print(ans)
S = list(input())
temp = 0
ans = 0
letter = ["A", "T", "C", "G"]
for i, val in enumerate(S):
  if val in letter:
    temp += 1
  else:
    if ans < temp:
      ans = temp
    temp = 0
print(ans)
def check_ACGT(S):
    length = len(S)
    for i in range(length):
        if not(S[i] == "A" or  S[i] == "G" or S[i] == "C" or S[i] == "T"):
            return 0
    
    return length

S = input()

tmp = 0
length = len(S)
for i in range(length):
    for j in range(i+1, length):
            tmp = max(tmp, check_ACGT(S[i:j+1]))

print(tmp)
s=input()
length=0
for i in range(len(s)):
    for j in range(i+1,len(s)):
        ans=s[i:j].replace('A','').replace('T','').replace('C','').replace('G','')
        if ans=='' and len(s[i:j])>=length:
            length=len(s[i:j])
print(length)
s=input()
tmp = 0
ans = -1
for i in range(len(s)):
  if s[i] in {"A","G","C","T"}:
    tmp += 1
  else:
    if ans <= tmp:
      ans = tmp
      tmp = 0
print(ans)
s=input()
n=int(len(s))
count=1
for i in range(n-1):
  if s[i]=='A' or s[i]=='C' or s[i]=='G' or s[i]=='T':
    if s[i+1]=='A' or s[i+1]=='C' or s[i+1]=='G' or s[i+1]=='T':
      count+=1
if count==1:
  print('0')
else:
  print(count)
# https://atcoder.jp/contests/abc122/tasks/abc122_b


S = input()
SPECIAL = ["A", "C", "G", "T"]

ans = 0
n = 0
for s in S:
    if s in SPECIAL:
        n += 1
    else:
        if ans < n:
            ans = n
        n = 0

print(ans)
checklist=["A","C","G","T"]
sn = list(input())

answer = 0
for i in range(len(sn)) :
  if sn[i] in checklist:
    count = 1
    for j in range(i+1,len(sn)):
      if sn[j] in checklist:
        count += 1
      else :
        if answer < count:
          answer = count
        break

print(answer)
s=input()
n=len(s)
a=["A","G","C","T"]
f=0
m=0
ans=0
for i in range(n):
    if f==0:
        if s[i] in a:
            ans+=1
            f=1
    elif f==1:
        if s[i] in a:
            ans+=1
        else:
            m=max(ans,m)
            f=0
            ans=0
print(m)
s = input()
maxi = 0

for start in range(len(s)):
    for end in range(start, len(s)):
        st = s[start:end]
        
        flag = True
        for ss in st:
            if ss!='A' and ss!='C' and ss!='G' and ss!='T':
                flag = False
            
        if flag:
            if len(st)>maxi:
                maxi=len(st)

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

count=0
v=0
for i in range(len(S)):
  if S[i] in DNA:
    count+=1
  else:
    if v < count:
      v=count
      count=0
    else:
      count=0

print(v)
S=input()
S+="b"
print(S)
ans=0
now=0
l=[i for i in "ACGT"]

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

print(ans)
s=input()

ans = 0
for i in range(len(s)):
    for j in range(i+1,len(s)):
        if s[i:j].count("A")==s[i:j].count("C")==s[i:j].count("G")==s[i:j].count("T")==0:
            ans = max(ans,j-i)
print(ans)
S=input()
cnt=0
ans=0
A=len(S)
for i in range(A):
  ans=max(cnt,ans)
  if S[i]=='A':
    cnt+=1
  elif S[i]=='C':
    cnt+=1
  elif S[i]=='G':
    cnt+=1
  elif S[i]=='T':
    cnt+=1
  else:
    cnt=0
print(ans)
s=input()
L=len(s)
cnt=0
ans=0
dic=["A", "G", "C", "T"]

for i in range(L):
    if s[i] in dic:
        cnt+=1
    else:
        if cnt > ans:
            ans=cnt
        cnt=0

print(ans)
s=input()

score=0

for i in range(len(s)):
    for j in range(i,len(s)):
        isbad = 0
        for k in range(i,j+1):
            if s[k] != "A" and s[k] != "C" and s[k] != "G" and s[k] != "T": 
                isbad=1
                break
        if isbad==0:
            score = max(j+1-i,score)
            print(s[i:j+1])
        
print(score)
s = input()
t = ['A','C','G','T']

ans = 0
tmp_ans = 0
for i in s:
    if i in t:
        tmp_ans += 1
    else:
        ans = max(tmp_ans, ans)
        tmp_ans = 0
print(ans)
s = input()
conti_cnt = 0
max_conti = 0
for i in s:
    if i in ['A', 'T', 'C', 'G']:
        conti_cnt += 1
    else:
        if max_conti < conti_cnt:
            max_conti = conti_cnt
            conti_cnt = 0
print(max_conti)
s = list(input())
count = 0
answer = 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:
		if count > answer:
			answer = count
		count = 0

print(answer)
s = input() #sys.stdin.readlineは最後が改行

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

print(ans)
S = input()
l = ['A', 'C', 'G', 'T']

start = False
counts = [0]

for i, c in enumerate(S):
	if c in l:
		if start == False:
			start = True
			count = 1
		else:
			count += 1
			if i == len(S) - 1:
				counts.append(count)
	else:
		if start == False:
			continue
		else:
			start = False
			counts.append(count)
			count = 0

print(max(counts))
s = input()

acgt = set("ACGT")

ans = 0

for i in range(len(s)):
    l = 0
    for j in range(i, len(s)):
        print(s[j])
        if s[j] in acgt:
            l += 1
        else:
            ans = max(ans, l)
            break
ans = max(ans, l)
print(ans)
s=input()
l=list("ACGT")
ans=0
for i in range(len(s)-1):
    for k in range(i+1,len(s)+1):
        if all(j in l for j in s[i:k+1]):
            ans=max(ans,len(s[i:k+1]))
print(ans)
S = list(input())
ACGT = set(["A","C","G","T"])
ans = 0
acgt_length = 0

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