Problem:
 Score : 200 points    Problem Statement You are given a string S consisting of uppercase English letters. Find the length of the longest ACGT string that is a substring (see Notes) of S .  Here, a ACGT string is a string that contains no characters other than A , C , G and T .      Notes A substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T .  For example, the substrings of ATCODER include TCO , AT , CODER , ATCODER and (the empty string), but not AC .      Constraints  S is a string of length between 1 and 10 (inclusive).  Each character in S is an uppercase English letter.         Input Input is given from Standard Input in the following format:  S       Output Print the length of the longest ACGT string that is a substring of S .        Sample Input 1 ATCODER      Sample Output 1 3  Among the ACGT strings that are substrings of ATCODER , the longest one is ATC .       Sample Input 2 HATAGAYA      Sample Output 2 5  Among the ACGT strings that are substrings of HATAGAYA , the longest one is ATAGA .       Sample Input 3 SHINJUKU      Sample Output 3 0  Among the ACGT strings that are substrings of SHINJUKU , the longest one is (the empty string).

Solution (Python):
s = input()
ans = 0

if len(s)==1:
    if s.count("A")+s.count("G")+s.count("C")+s.count("T") == 1:
        print(1)
        exit()

 
for i in range(len(s)-1):
    for j in range(i+1, len(s)+1):
        x = s[i:j]
        if x.count("A")+x.count("G")+x.count("C")+x.count("T") == len(x) and len(x) > ans:
            ans = len(x)
 
print(ans)

Solution (Python):
s = input()

count = 0
for i in range(len(s)):
    x = 0
    for j in range(i,len(s)):
        if(s[j] == 'A' or s[j] == 'C' or s[j] == 'G' or s[j] == 'T'):
            x += 1
        else:
            break
    if(count < x):
        count = x

print(count)

Solution (Python):
ACGT = ["A","C","G","T"]
S = input()

moji= []
word = ""

for i in range(len(S)):
    
    if S[i] in ACGT:
        word += S[i]
        moji.append(word)
    else:
        
        word = ""    


answer = ""
for i in range(len(moji)):
    
    if len(moji[i]) > len(answer):
        answer = moji[i]
print(len(answer))

Solution (Python):
S = input()
ans,temp = 0,0
for x in S:
    if x in 'ACGT':
        temp += 1
    else:
        temp = 0
    ans = max(ans,temp)
print(ans)

Solution (Python):
def check(s):
    return s == 'A' or s == 'C' or s == 'G' or s == 'T'


S = input()
ans = 0
tmp = 0
for s in S:
    tmp = tmp + 1 if check(s) else 0
    ans = max(ans, tmp)
print(ans)

Solution (Python):

import sys

S = str(input())
target = ['A', 'C', 'G', 'T']

ans = 0
temp_ans = 0
for s in S:
    if s in target:
        temp_ans += 1
    else:
        temp_ans = 0
    ans = max(ans, temp_ans)

print(ans)

Solution (Python):


import numpy as np

def rle(x):
    ''' Run Length Encoding

    rle('001111000000011')
    (array([2, 4, 7, 2]),
     array(['0', '1', '0', '1'], dtype='<U1'))

    rle('aabcccbbbaab')
    (array([2, 1, 3, 3, 2, 1]),
     array(['a', 'b', 'c', 'b', 'a', 'b'], dtype='<U1'))
    '''
    x = np.array(list(x))
    n = len(x)
    if n == 0:
        return (1, '')
    y = list(map(lambda a, b: a != b, x[1:], x[:-1]))
    i = np.hstack((np.where(y)[0]+1, n))
    return (np.diff(np.hstack((0, i))), x[i-1])

s = list(input())
for i in range(len(s)):
    if s[i] == 'T' or s[i] == 'C' or s[i] == 'G':
        s[i] = 'A'
count, value = rle(s)
obj = count[value == 'A']
if len(obj) == 0:
    print(0)
else:
    print(max(obj))

Solution (Python):
S = input()
ml = 0

for i in range (len(S)):
  for j in range (i+1, len(S)+1):
    cnt = S[i:j].count("A")+S[i:j].count("G")+S[i:j].count("C")+S[i:j].count("T")
    if cnt == len(S[i:j]) and cnt > ml:
      ml = cnt
    
print(ml)

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

print(ans)

Solution (Python):
S = input()
L = ['A', 'T', 'G', 'C']
N = len(S)
num = 0
ans = 0
for i in range(N):
    if S[i] in L:
        num += 1
    else:
        ans = max(num, ans)
        num = 0
ans = max(num, ans)
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline


def read():
    S = input().strip()
    return S,


def solve(S):
    alphabets = ['A', 'C', 'G', 'T']
    max_count = 0
    count = 0
    for s in S:
        if s in alphabets:
            count += 1
        else:
            max_count = max(max_count, count)
            count = 0
    max_count = max(max_count, count)
    return max_count


if __name__ == '__main__':
    inputs = read()
    print(solve(*inputs))

Solution (Python):
ACGT = ["A", "C" ,"G", "T"]
s = input()
ans = 0
temp = 0
for i in s:
  ok = False
  for j in ACGT:
    if i == j:
      ok = True
      temp += 1
  if ok == False:
    ans = max(ans, temp)
    temp = 0
ans = max(ans, temp)
print(ans)

Solution (Python):
S=input()
res=0
for st in [S[x:y] for x in range(len(S)+1) for y in range(len(S)+1) if x<=y]:
    for c in st:
        if not c in ('A','C','G','T'):
            break
    else:
        if res<len(st):
            res=len(st)
print(res)

Solution (Python):
S = input()
ans = 0
for i in range(len(S)):
    for j in range(len(S), i, -1):
        trial = {x for x in S[i:j] if x not in 'ACGT'}
        if len(trial) == 0 and ans < len(S[i:j]):
            ans = len(S[i:j])
print(ans)

Solution (Python):
s = str(input())

res = 0
max_res = 0
for i in range(len(s)):
    if s[i] == 'A' or s[i] == 'T' or s[i] == 'G' or s[i] == 'C':
        res += 1
        if res > max_res:
            max_res = res
    else:
        res = 0
print(max_res)

Solution (Python):
s = input()
n = len(s)

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

print(ans)

Solution (Python):
S = input()
ATGC = "ATGC"

cnt_ = 0
for i in range(len(S)):
    cnt = 0
    for j in range(i,len(S)):
        if S[j] in ATGC:
            cnt += 1
        else:
            break
    
    if cnt > cnt_:
        cnt_ = cnt

print(cnt_)

Solution (Python):
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)

Solution (Python):
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
        if cnt > ans:
            ans=cnt
    else:
        if cnt > ans:
            ans=cnt
        cnt=0


print(ans)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
S = input()

cnt = 0
max_str = 0
flg = True
for x in range(len(S) + 1):
    for y in range(x, len(S) + 1):
        for i in range(len(S[x:y])):
            if "A" in (S[x:y][i]) or "C" in (S[x:y][i]) or "G" in (S[x:y][i]) or "T" in (S[x:y][i]):
                flg = True
            else:
                flg = False
                break
        if flg is True:
            max_str = max(max_str, len(S[x:y]))

print(max_str)

Solution (Python):
s = input()
code = ['A','T','G','C']
ans = 0
l = len(s)
for i in range(l):
    for j in range(i,l):
        t = s[i:j+1]
        if set(t) <= set(code):
            ans = max(ans,j-i+1)
print(ans)

Solution (Python):
s = input()
ans = 0
acgt = ['A', 'C', 'G', 'T']
tmp = 0
for c in s:
    if c in acgt:
        tmp += 1
    else:
        ans = max(tmp, ans)
        tmp = 0
print(max(tmp, ans))

Solution (Python):

s = input()
atgc = set(['A','T','G','C'])
cnt = 0
acgt_len = []
for i in range(len(s)):
    if s[i] in atgc:
        cnt += 1
        
    else:
        acgt_len.append(cnt)
        cnt = 0
        
acgt_len.append(cnt)

print(max(acgt_len))

Solution (Python):
l = ['A','T','C','G']
s = input()
cnt=0
mcnt=0
for i in s:
    if i in l:
        cnt+=1
        mcnt = max(mcnt,cnt)
    else:
        cnt = 0
print(mcnt)

Solution (Python):
l = ['A','T','C','G']
s = ''
tmp =[]
st = input()
for i in st:
    if i in l:
        s+=i
    else:
        tmp.append(s)
        s = ''
else:
    tmp.append(s)
print(max(list(map(len,tmp))))

Solution (Python):
S = input()
kouho = []

for i in range(len(S) + 1):
  for j in range(1, len(S) + 1):
    s = S[i : j]
    if len(s) == s.count("A") + s.count("C") + s.count("G") + s.count("T"):
      kouho.append(len(s))
print(max(kouho))

Solution (Python):
s = input()
ans = 0
for i in range(1,len(s)+1): 
    for j in range(len(s)-i+1): 
        if all(s[k]=='A' or s[k]=='G' or s[k]=='C' or s[k]=='T' for k in range(j,j+i)):
            ans = i
print(ans)

Solution (Python):
s = input()
ans = 0
tmp = 0
for c in s:
  if c in ['A', 'T', 'G', 'C']:
    tmp += 1
  else:
    ans = max(ans, tmp)
    tmp = 0
ans = max(ans, tmp)
print(ans)

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

Solution (Python):
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")

Solution (Python):
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)

Solution (Python):
s = input()
ans = 0
tmp = 0
for i in s:
    if i in ['A','C','G','T']:
        tmp += 1
    else:
        tmp *= 0
    ans = max(ans, tmp)
print(ans)

Solution (Python):
n=input()
lis=["A","C","G","T"]
num=0
mx=0
for i in n:
  if i in lis:
    num+=1
  else:
    num=0
  if mx<num:
    mx=num
print(mx)

Solution (Python):
S = input()

sample = ["A", "C", "G", "T"]
result = [0] * len(S)
for i in range(len(S)):
    if S[i] in sample:
        if i == 0:
            result[i] += 1
        else:
            result[i] += 1 + result[i - 1]


print(max(result))

Solution (Python):
s = input()

l, cur = 0, 0
for c in s:
    if c in "ACGT":
        cur += 1
        if cur > l:
            l = cur
    else:
        cur = 0
print(l)

Solution (Python):
S = input()
n = len(S)
ans = 0
list = ['A', 'G', 'C', 'T']
for i in range(n):
    j = i
    while j < n:
        if S[j] in list:
            j += 1
        else:
            if ans < j - i :
                ans = j - i
            break
    if j == n:
        if ans < j - i :
                ans = j - i
print(ans)

Solution (Python):
s=input()
le=len(s)
lis=[]
for i in range(0,le):
  if s[i]!="A" and s[i]!="C" and s[i]!="T" and s[i]!="G":
    lis.append(i)
lo=0
for j in range(0,len(lis)-1):
  if lis[j+1]-lis[j]-1>=lo:
    lo=lis[j+1]-lis[j]-1
if bool(lis):
  if lis[0]>=lo:
    lo=lis[0]
  if le-lis[-1]-1>=lo:
    lo=le-lis[-1]-1
  print(lo)
else:
  print(le)

Solution (Python):
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))

Solution (Python):
S = input()
count = 0
mcount = 0
for i in range (len(S)):
    if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
        count = count +1
        mcount = max(mcount,count)
    else:
        count = 0
print(mcount)

Solution (Python):
ans = []
cnt = 0

for s in input():

    if not s in "ACGT":
        ans.append(cnt)
        cnt = 0
        continue
    
    cnt += 1

ans.append(cnt)

print(max(ans) if len(ans) != 0 else 0)

Solution (Python):
S = input()
ans = 0
tmp2 = 0
for i in range(0,len(S)):
  tmp = S[i]
  if(tmp == "A" or tmp == "G" or tmp == "C" or tmp == "T"):
    ans += 1
  else:
    ans = 0
  tmp2 = max(ans,tmp2)
print(str(tmp2))

Solution (Python):
if __name__ == "__main__":
  S = input()
  
  maxLen = 0
  for start in range(len(S)):
    for end in range(start, len(S)+1):
      if set(S[start:end]) <= set("ATCG"):
        maxLen = max(end-start, maxLen)
        
  print(maxLen)

Solution (Python):
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
if flag:
    cnt_lst.append(cnt)

print(max(cnt_lst)) if cnt_lst else print(0)

Solution (Python):
s = input()

ans = 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
        for j in range(i+1, len(s)):
            if s[j] == 'A' or s[j] == 'C' or s[j] == 'G' or s[j] == 'T':
                count += 1
            else:
                break
        if ans <= count:
            ans = count
print(ans)

Solution (Python):
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)
    else:
        cnt = 0

print(mcnt)

Solution (Python):
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
            elif(k==len(S)-1):
                ans = k-i+1
                if(ans>Max):
                    Max = ans
            k+=1
print(Max)

Solution (Python):

import re
s = input()
target = re.sub('[^ACGT]', '@', s)
num_list = []
for t in target.split('@'):
  num_list.append(len(t))
print(max(num_list))

Solution (Python):
S = input()
count = 0
count_max = 0

for k in range(len(S)):
    if S[k] == "A" or S[k] == "C" or S[k] == "G" or S[k] == "T":
        count += 1
        if count > count_max:
             count_max = count
    else:
        count=0
print(count_max)

Solution (Python):
s = input()
count = 0
count_max = 0

for k in range(len(s)):
    if s[k] == "A" or s[k] == "C" or s[k] == "G" or s[k] == "T":
        count += 1
        if count > count_max:
             count_max = count
    else:
        if count_max < count:
            count_max = count
        else:
            count = 0
print(count_max)

Solution (Python):
s=input()




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(max(m,len(s1)))

Solution (Python):
s = input()

chain = 0
max_chain = 0
for i in range(len(s)):
    if (s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T'):
        chain += 1
    else:
        if(chain > max_chain):
            max_chain = chain
            chain = 0
    if (i == len(s)-1):
        if(chain > max_chain):
            max_chain = chain
            chain = 0
            
print(max_chain)

Solution (Python):
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)

Solution (Python):
S = list(input())
count = 0
current = 0
for i in range(len(S)):
    if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
        current += 1
    else:
        if current > count:
            count = current
        current = 0
if current > count:
    count = current
print(count)

Solution (Python):
S = list(input())
count = 0
current = 0
for i in range(len(S)):
    if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
        current += 1
        if current > count:
            count = current
    else:
        if current > count:
            count = current
        current = 0
print(count)

Solution (Python):


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':
        if i!=len(S)-1:
            cnt += 1
        else:
            cnt += 1
            ans = max(ans, cnt)    
    else:
        ans = max(ans, cnt)
        cnt = 0

print(ans)

Solution (Python):
def main():
    
    s = input()

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

    cnt = 0
    current_cnt = 0
    for c in s:
        if c in target:
            current_cnt += 1
        else:
            if current_cnt > cnt:
                cnt = current_cnt
            current_cnt = 0

    if current_cnt > cnt:
        cnt = current_cnt
    print(cnt)


main()

Solution (Python):
def atcoder(s):

    ans = 0
    count = 0
    acgt = ["A", "C", "G", "T"]

    for i in s:
        if i in acgt:
            count += 1
        else:
            count = 0
        ans = max(ans, count)
    return ans

def main():
    s = list(str(input()))
    print(atcoder(s))

if __name__ == '__main__':
    main()

Solution (Python):
s = input()
c = 0
x = 0
for i in range(len(s)):
    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
        c += 1
    else:
        x = max(c, x)
        c = 0
print(max(c, x))

Solution (Python):
s=input()
a,b=0,0
for i in range(len(s)):
    if s[i]=="A" or s[i]=="C" or s[i]=="G" or s[i]=="T":
        a+=1
    else:
        b=max(a,b)
        a=0
print(max(a,b))

Solution (Python):
import sys
import math
from collections import Counter
import itertools



def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())

def LI(): return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'


p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")



s=SR()
atcoder=0
m=0
target=('A','C','G','T')

for i in range(len(s)):
    if s[i] in target:
        atcoder+=1
    else:
        m=max(m,atcoder)
        atcoder=0
print(max(atcoder,m))

Solution (Python):
s = input()
n = len(s)
ans = 0
for i in range(n):
    for j in range(i,n):
        if all("ATGC".count(c) == 1 for c in s[i:j+1]):
            ans = max(ans,j - i + 1)
print(ans)

Solution (Python):
s = input()
c = 0
ans = 0
for i in range(len(s)):
    if (s[i]=="A" or s[i]=="C" or s[i]=="G" or s[i]=="T"):
        c += 1
        if (ans < c):
            ans = c
    else:
        c = 0
print(ans)

Solution (Python):
s = input()
a = [-1]
b = 0
for n in range(len(s)):
    if s[n] != "A" and s[n] != "C" and s[n] != "G" and s[n] != "T":
        a.append(n)
a.append(len(s))
for n in range(len(a)-1):
    b = max(b, a[n+1]-a[n]-1)
print(b)

Solution (Python):
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]))

Solution (Python):
s=input()
length=0
for i in range(len(s)):
    for j in range(i+1,len(s)+1):
        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)

Solution (Python):
S = input()
M = 0
con = 0

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

for i,s in enumerate(S):
  if S[i] in L:
    con += 1
    M = max(M,con)
  elif S[i] not in L:
    con = 0
    M = max(M,con)

print(M)

Solution (Python):
s = input()

a_s = ["A","C","G","T"]
l=[]
for i in range(len(s)):
    if s[i] in a_s:
        l.append(1)
    else:
        l.append(0)

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

Solution (Python):
S = input()
cnt = 0
ans = []
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:
        ans.append(cnt)
        cnt = 0
ans.append(cnt)
print(max(ans))

Solution (Python):
S = input()
acgt = ['A', 'C', 'G', 'T']
ans = 0
for i in range(len(S), 0, -1):
    for j in range(len(S) - i + 1):
        for k, s in enumerate(S[j:i + j]):
            if not s in acgt:
                break
            if k == len(S[j:i + j]) - 1:
                ans = len(S[j:i + j])
            
        if ans != 0:
            break
    else:
        continue
   
    break    
    
print(ans)

Solution (Python):


def main():
    s = input()
    acgt = ('A', 'C', 'G', 'T')
    s += 'x'
    max_ = 0
    cnt = 0

    for char in s:
        if char in acgt:
            cnt += 1
        else:
            if cnt > max_:
                max_ = cnt
            cnt = 0

    print(max_)

if __name__ == '__main__':
    main()

Solution (Python):
s = input()
table = [0 for i in range(len(s))]
acgt = ['A', 'C', 'G', 'T']
for i in range(len(s)):
    if s[i] in acgt:
        table[i] += 1

count = 0
ans = 0
for i in table:
    if i:
        count += 1
        ans = max(ans, count)
    else:
        count = 0
print(ans)

Solution (Python):
s=input()
a=0
b=0
for i in range(len(s)):
  if s[i]=='A' or s[i]=='G' or s[i]=='C' or s[i]=='T':
    b+=1
    a=max(a,b)
  else:
    b=0
print(a)

Solution (Python):
s = input()
i = 0
ans = 0
atcg = "ACGT"
for i in range(len(s)):
    for j in range(i, len(s)):
        t = s[i: j + 1]
        cnt = 0
        for n in range(4):
            cnt += t.count(atcg[n])
        
        if cnt == len(t):
            ans = max(ans, cnt)
        
    
print(ans)

Solution (Python):
s = input()
count = 0
a = 0
for name in s:
    if name == 'A' or name == 'C' or name == 'G' or name == 'T':
        count += 1
    else:
        if count > a:
            a = count
            count = 0
if count > a:
    a = count
print(a)

Solution (Python):
s = input()
acgt = ['A', 'C', 'G', 'T']
cnt = 0
ans = []

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

print(max(ans))

Solution (Python):
import itertools
S = input()
L = len(S)

ans = 0
for i,j in itertools.combinations(range(L+1),2):
  ss = S[i:j]
  ok = True
  for s in list(ss):
    if not(s == 'A' or s == 'C' or s == 'G' or s == 'T'):
      ok = False
      break
      
  if ok:
    ans = max(ans,j-i)
    
print(ans)

Solution (Python):
import re
S=input()
match=re.findall(r'[AGCT]+',S)
if len(match)==0:
  print(0)
else:
  print(max(len(s) for s in match))

Solution (Python):
import math
import sys
s = input()
def isACGT(n):
    for i in range(len(n)):
        if (n[i] != 'A' and n[i] != 'C' and n[i] != 'G' and n[i] != 'T'):
            return False
    return True
ans=0
for i in range(len(s)):
    for j in range(1, len(s)+1):
        if (isACGT(s[i:j]) and len(s[i:j]) > ans):
            ans = len(s[i:j])
print(ans)

Solution (Python):
S = input()

ACGT = 'ACGT'

ans = 0
for i in range(len(S)):
    for j in range(i, len(S) + 1):
        if all(c in ACGT for c in S[i:j]):
            ans = max(ans, j - i)

print(ans)

Solution (Python):
S = input()
a = 'ACGT'
memo = []
cnt = 0
for s in S:
  if s in a:
    cnt += 1
  else:
    cnt = 0
  memo.append(cnt)
print(max(memo))

Solution (Python):
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()

Solution (Python):
def resolve():
    s=input()
    num=0
    for i in range(len(s)):
        for j in range(len(s)+1):
            s1=s[i:j]
            if 'B' not in s1 and 'D' not in s1 and 'E' not in s1 and 'F' not in s1\
                    and 'H' not in s1 and 'I' not in s1 and 'J' not in s1 and 'K' not in s1 and 'L' not in s1 and\
                    'M' not in s1 and 'N' not in s1 and 'O' not in s1 and 'P' not in s1 and 'Q' not in s1 and\
                    'R' not in s1 and 'S' not in s1 and 'U' not in s1 and 'V' not in s1 and 'W' not in s1 and\
                    'X' not in s1 and 'Y' not in s1 and 'Z' not in s1 and len(s1)>=num:
                num=len(s1)
    print(num)
resolve()

Solution (Python):
s = input()
cnt = 0
max_cnt = 0
for i in s:
    if i in ['A', 'T', 'C', 'G']:
        cnt += 1
    else:
        cnt = 0
    max_cnt = max(max_cnt, cnt)
print(max_cnt)

Solution (Python):
s = input()
n = len(s)
len = n


while len >= 1:
  for i in range(n-len + 1):
    sub = s[i:i+len]    
    for c in sub:
      if c not in ['A','T','G','C']:
      	break
    else:
      print(len)
      exit()
  len-=1
  
print(len)

Solution (Python):
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
if max_conti < conti_cnt:
    max_conti = conti_cnt
print(max_conti)

Solution (Python):


s=input()
n=len(s)

ans=0
tmp=0
for i in range(n):
    if s[i]=='A' or s[i]=='C' or s[i]=='G' or s[i]=='T':
        tmp=1
        for j in range(i+1,n):
            if s[j]=='A' or s[j]=='C' or s[j]=='G' or s[j]=='T':
                tmp+=1
            else:
                break
        if tmp>ans:
            ans=tmp
        
print(ans)

Solution (Python):
S=input()
ACGT=['A','C','G','T']
ans=[0]
k=0
while k<len(S):
    num=0
    if S[k] in ACGT:
        num=1
        for i in range(1,len(S)-k):
            if S[k+i] in ACGT:
                num+=1
            else:
                break
        ans.append(num)
    else:
        num=1
    k+=num

print(max(ans))

Solution (Python):
N = list(input())
dp = [0]*(len(N)+1)
for i in range(len(N)):
  if N[i] in'ACGT':
    dp[i] += 1
    dp[i+1] = dp[i]
  else:
    dp[i] = 0
print(max(dp))

Solution (Python):
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)

Solution (Python):
s = input()

n = len(s)

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

print(max(ans,res))

Solution (Python):
S = input()

N = len(S)
T = ['A', 'C', 'G', 'T']
ans = 0
now = 0

for a in S:
    isATCG = False
    if a in T:
        isATCG = True

    if isATCG:
        now += 1
        ans = max(ans, now)
    else:
        now = 0
        isATCG = False

print(ans)

Solution (Python):
s = input().strip()
ans = 0
rep = 0
for c in s:
    if c == 'A' or c == 'C' or c == 'G' or c == 'T':
        rep += 1
    else:
        ans = max(ans, rep)
        rep = 0
ans = max(ans, rep)
print(ans)

Solution (Python):
s = input()
cnt = 0
max_cnt = 0
for i in s:
    if i in ['A', 'T', 'C', 'G']:
        cnt += 1
    else:
        cnt = 0
    max_cnt = max(max_cnt, cnt)
print(max_cnt)

Solution (Python):
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
if max_conti < conti_cnt:
    max_conti = conti_cnt
print(max_conti)

Solution (Python):
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)

Solution (Python):
s = input()
s_x = s+"X"
list_s = ["A","C","T","G"]
ans = []
count=0
for i in s_x:
    
    if i in list_s:
        count+=1
    else:
        ans.append(count)
        count=0

print(max(ans))

Solution (Python):
s = input()
n = len(s)

def is_agct(c):
    return c == 'A' or c == 'G' or c == 'T' or c == 'C'

def find_agct(s, l):
    n = len(s)
    while (l < n and not is_agct(s[l])):
        l = l + 1
    return l

ans = 0

l = find_agct(s, 0)
r = l + 1
while (l < n):
    while (r < n and is_agct(s[r])):
        r = r + 1
    ans = max(ans, r - l)
    l = find_agct(s, r)
    r = l + 1

print(ans)

Solution (Python):

"""
https://atcoder.jp/contests/abc122/tasks/abc122_b
"""

def solve():
    S = input()

    ans = 0
    cnt = 0
    for c in S:
        if c in ("A", "C", "G", "T"):
            cnt += 1
        else:
            ans = max(ans, cnt)
            cnt = 0
    ans = max(ans, cnt)

    print(ans)


if __name__ == "__main__":
    solve()

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

Solution (Python):
S = input()
count = 0
res = 0
for i in S:
    if i in ["A", "C", "G", "T"]:
        count += 1
    else:
        count = 0
    res = max(count, res)
print(res)

Solution (Python):
s = input()
ans=0
now=0
for a in s:
    if a in ["A", "C", "G", "T"]:
        now+=1
    else:
        now=0
    ans=max(ans,now)
print(ans)

Solution (Python):

s = input()
num = 0
ans = 0
for i in range(len(s)):
    if s[i] == "A"or s[i] == "G" or s[i] == "C"or s[i] == "T":
        for j in range(i, -1, -1):
            if s[j] == "A"or s[j] == "C"or s[j] == "G"or s[j] == "T":
                num += 1
            else:
                break
        for k in range(i+1, len(s)):
            if s[k] == "A"or s[k] == "C"or s[k] == "G"or s[k] == "T":
                num += 1
            else:
                break
        if num > ans:
            ans = num
        num = 0
print(ans)

Solution (Python):
s = input()
ans=0
now=0
for a in s:
    if(a=='A' or a=='G' or a=='C' or a=='T'):
        now+=1
    else:
        now=0
    ans=max(ans,now)
print(ans)

Solution (Python):
s = input() 

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
ans = max(ans,cnt)
print(ans)

Solution (Python):
import sys
s = input()
b = True
max_ = 0
for i in range(len(s)):
    s1 = s[i:]
    for k in range(len(s1)):
        b = True
        s2 = s1[:len(s1)-k]
        for j in s2:
            if j != 'A' and j!='T' and j != 'G' and j!='C':
                b = False
        if b:
            max_ = max(max_, len(s2))
print(max_)

Solution (Python):
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)

Solution (Python):
import math
import sys

s = input()
acgt = ['A', 'C', 'G', 'T']
ans, cnt = 0, 0
for c in s:
    if c in acgt:
        cnt += 1
    else:
        ans = max(ans, cnt)
        cnt = 0

ans = max(ans,cnt)
print(ans)

Solution (Python):
S = input()

l = len(S)

max_cnt = 0
for i in range(l):
    for j in range(i, l):
        res = [1 if s == "A" or s == "C" or s == "G" or s == "T" else 0 for s in S[i : j + 1]]
        if sum(res) == len(res):
            max_cnt = max(sum(res), max_cnt)
print(max_cnt)

Solution (Python):
import math
import itertools
import numpy as np

def solve():
    s = input()
    le = len(s)
    ans = 0
    for i in range(le):
        for j in range(i, le):
            if all("AGCT".count(k) == 1 for k in s[i:j+1]):
                ans = max(ans, j-i+1)
    print(ans)
    return 0

if __name__ == "__main__":
    solve()