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()
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()
m=0
count=0
for s in S:
    if s in "A":count+=1
    elif s in "C":count+=1
    elif s in "G":count+=1
    elif s in "T":count+=1
    else:count=0
    m=max(m,count)
print(m)

Solution (Python):
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
ans = max(ans, temp)
print(ans)

Solution (Python):
checklist=['A','C','G','T']
sn = list(input())

answer = 0
count = 0
for s in sn :
  if s in checklist:
    count += 1
  else :
    count = 0
  answer = max(answer,count)

print(answer)

Solution (Python):
S = input()
m =  0
cnt = 0
for s in S:
    if s == 'A':
        cnt += 1
    elif s == 'C':
        cnt += 1
    elif s == 'G':
        cnt += 1
    elif s == 'T':
        cnt += 1
    else:
        cnt = 0
    m = max(m, cnt)
print(m)

Solution (Python):
S=[0]+list(input())
L=[0]
SET=["A","G","C","T"]
SET=set(SET)
for i in range(1,len(S)):
    if S[i] not in SET:
        L.append(0)
    else:
        L.append(L[-1]+1)
print(max(L))

Solution (Python):
s = input()
ans = 0
m = 0
for i in s:
  if i in "ACGT":
    m += 1
    if m > ans:
      ans = m
  else:
    m = 0
print(ans)

Solution (Python):
def resolve():
    '''
    code here
    '''
    S = input()
    res = 0
    max_res = 0
    for i in range(len(S)):
        if S[i] in ['A', 'C', 'G', 'T']:
            res += 1
        else:
            res = 0
        max_res = max(max_res, res)
    print(max_res)
if __name__ == "__main__":
    resolve()

Solution (Python):
S = input()

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

Solution (Python):
S = input()
ma = 0
ma_ = 0
for c in S:
    if c == 'A' or c == 'C' or c == 'G' or c == 'T':
        ma_ += 1
    else:
        ma = max(ma, ma_)
        ma_ = 0
ma = max(ma, ma_)
print(ma)

Solution (Python):
S = input()
N = len(S)
ans = 0
for i in range(N):
    for j in range(i + 1, N + 1):
        ss = S[i:j]
        for c in ss:
            if not c in ("A", "C", "G", "T"):
                break
        else:
            ans = max(ans, len(ss))
print(ans)

Solution (Python):
s = input()
ans = 0
for i in range(len(s)):
  for j in range(i,len(s)):
    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()
left = 0
ans = 0
for right in range(0,len(s)):
  if s[right] in ("A","C","G","T"):
    pass
  else:
    left=right+1
  ans = max(ans,right-left+1)
print(ans)

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

Solution (Python):
S = input()

AGCT = ['A','G','C','T']
AGCT_list = []

i = 0
while i < len(S):
    
    if S[i] in AGCT:
        k = 1
        agct_tmp = S[i]
        if i+k < len(S):
            while S[i+k] in AGCT:
                
                
                agct_tmp += S[i+k]
                if i+k+1 < len(S):
                    k +=1
                else:
                    break
    
        AGCT_list.append(agct_tmp)
        i = i + k + 1
    else:
        i += 1
if AGCT_list:
    print(max([len(string) for string in AGCT_list]))
else:
    print('0')

Solution (Python):
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

S = X()
a = [0]
b = ["A","G","C","T"]

for i in range(len(S)):
    if S[i] in b:
        count += 1
        a.append(count)
    else:
        count = 0

print(max(a))

Solution (Python):
S = input()
N = len(S)

ans = 0
for i in range(N+1):
    for j in range(i+1, N+1):
        if set(S[i:j]) <= set('ACGT'):
            ans = max(ans, j-i)
print(ans)

Solution (Python):
S = input()
N = len(S)

ans = 0
for i in range(N+1):
    for j in range(i+1, N+1):
        l = 0
        for c in 'ACGT':
            l += S[i:j].count(c)
        if l == j - i:
            ans = max(ans, l)
print(ans)

Solution (Python):
S = input()
x = ['A', 'C', 'T', 'G']

i = 0
count = 0
ans = 0
while i < len(S):
    if S[i] in x:
        count += 1
        ans = max(ans, count)
    else:
        count = 0
    i += 1
print(ans)

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

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

CNT = 0

ANS = [0]
for s in S:
    if s in "ACTG":
        CNT += 1
    elif CNT != 0:
        ANS.append(CNT)
        CNT = 0
ANS.append(CNT)

print(max(ANS))

Solution (Python):
from math import gcd
import re
s=input()
match=re.findall("[ACGT]*",s)
length=0
for i in match:
    length=max(length,len(i))
print(length)

Solution (Python):
S = input()
c = []
count= 0
enki = ['A','C','G','T']
for i in range(len(S)):
  if S[i] in enki:
    count += 1
    c.append(count)
  else:
    count = 0
    c.append(count)
print(max(c))

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

Solution (Python):
S = input()

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

Solution (Python):
S = input()
acgt = {'A','C','G','T'}
m = 0
c = 0
for s in S:
  if s in acgt:
    c+=1
    m = max(m,c)
  else:
    m = max(m,c)
    c = 0
print(m)

Solution (Python):
S = input()
A = ["A", "G", "C", "T"]
count = 0
j = 0
ans = 0
for i in range(len(S)):
    j = i
    while S[i] in A:
        count += 1
        i += 1
        if i == len(S):
            break

    i = j
    ans = max(ans, count)
    count = 0
print(ans)

Solution (Python):
import sys
import re

rr = lambda: sys.stdin.readline().rstrip()
txt = rr()
box = re.findall(r'[ATCG]+', txt)
ans = 0
for i in box:
    ans = max(len(i), ans)
print(ans)

Solution (Python):
S = input()
F = "ATGC"
cnt = 0
n = len(S)
for i in range(n):
  for j in range(i+1, n+1):
    flg = True
    for k in range(i, j):
      flg *= (S[k] in F)
    if flg:
      cnt = max(cnt, j - i)
print(cnt)

Solution (Python):
l = ('A', 'T', 'C', 'G')
S = input()

ans = [0]
res = 0
for i in range(len(S)):
    if S[i] in l:
        res += 1
    elif res != 0:
        ans.append(res)
        res = 0
ans.append(res)

print(max(ans))

Solution (Python):
l = ('A', 'T', 'C', 'G')
S = input()

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

print(ans)

Solution (Python):
s=input()
Flag=True
cnt=0
ans=0
for i in range(len(s)):
    if s[i] in 'ACGT':
        cnt+=1

    else:
        ans=max(ans,cnt)
        cnt=0
ans=max(ans,cnt)
print(ans)

Solution (Python):
S = list(input())
T = ['1' if s in ['A', 'C', 'G', 'T'] else '0' for s in S]

max_count = 0
count = 0
for c in T:
    if c == "1":
        count += 1
        max_count = max(max_count, count)
    else:
        count = 0
print(max_count)

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

Solution (Python):
S = input()
ans = 0
count = 0
for s in S:
    if s not in "AGCT":
        ans = max(ans, count)
        count = 0
    else:
        count += 1
ans = max(ans, count)
print(ans)

Solution (Python):
import re
print(max(map(len,re.split("[BDEFHIJKLMNOPQRSUVWXYZ]",input()))))

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

for s in S:
  if s in T:
    c+=1
  else:
    c=0
  A+=[c]
  
print(max(A))

Solution (Python):
s = input()

ans = 0
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
        ans = max(ans, count)
    else:
        count = 0

print(ans)

Solution (Python):
s = input()
dic = {"A", "T", "C", "G"}

k = [1 if s[i] in dic else 0 for i in range(len(s))]

result = []
for i in range(len(k)):
    cnt = 0
    if k[i] == 1:
        cnt = 1
        j = i-1
        while j >= 0:
            if k[j] == 1:
                cnt += 1
                j -= 1
            else:
                break
    result.append(cnt)

print(max(result))

Solution (Python):
s = input()

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

print(ans)

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

Solution (Python):
""" tutorial03
    https://atcoder.jp/contests/abc122/tasks/abc122_b
"""
import sys
import math

def main(s):
    """ main
    """
    result = 0
    count = 0

    for c in s:
        if c in ["A", "T", "C", "G"]:
            count += 1
        else:
            if result < count:
                result = count
            count = 0

    if result < count:
        result = count

    return result

if __name__ == "__main__":
    S = sys.stdin.readline()

    print(main(S))

Solution (Python):
S="x"+input()

T=[0]*(len(S)+1)
U={"A","C","G","T"}

for i in range(len(S)):
    if S[i] in U:
        T[i]=T[i-1]+1
    else:
        T[i]=0
print(max(T))

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

Solution (Python):
s = input()

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

ans = 0
cnt = 0

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

Solution (Python):


def get_input() -> str:
    """
    標準入力を取得する.

    Returns:\n
        str: 標準入力
    """
    S = input()

    return S


def main(S: str) -> None:
    """
    メイン処理.

    Args:\n
        S (str): 長さ1以上10以下の英大文字列
    """
    
    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)


if __name__ == "__main__":
    
    S = get_input()

    
    main(S)

Solution (Python):


S = input()


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


def is_acgt(s: str) -> bool:
    return s in ACGT


N = len(S)
ans = 0
for s in range(N):
    S_s = S[s]
    if not is_acgt(S_s):
        continue
    acgt_length = 1
    for e in range(s + 1, N):
        S_e = S[e]
        if not is_acgt(S_e):
            break
        acgt_length += 1
    ans = max(ans, acgt_length)


print(ans)

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

Solution (Python):
S=input()
T='ATCG'

flag =0
ans =0
now =0

for i in range(len(S)):
    flag =0
    for j in range(4):
        if S[i] == T[j]:
            flag +=1
    if flag !=1:
        now =0
    else:
        now +=1
        ans = max(now, ans)
        


print(ans)

Solution (Python):
S=input()
N=len(S)
left=0
right=0
ans=0
for left in range(N):
    while(right<N and (S[right] in ["A","C","G","T"])):
        right+=1
        ans=max(ans,right-left)
    if left==right:
        right+=1
print(ans)

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

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

Solution (Python):
s = str(input())
count=0
flg = False
max=0
for x in range(len(s)):
    if s[x] == 'A' or s[x] == 'T' or s[x] == 'C' or s[x] == 'G':
        count+=1
        if max <= count:
            max=count
    else:
        count=0
print(max)

Solution (Python):
def main():
    S = input()
    combs = set()
    max_len = 0
    for i in range(len(S)):
        for j in range(len(S), i - 1, -1):
            S_tmp = S[i:j]
            for s in S_tmp:
                if s not in ["A", "C", "G", "T"]:
                    break
            else:
                combs.add(S_tmp)

    for s in combs:
        max_len = max(max_len, len(s))

    print(max_len)


if __name__ == '__main__':
    main()

Solution (Python):
S=input()
c=0
d=0
for i in S:
    if i=="A":
        c+=1
    elif i=="C":
        c+=1
    elif i=="G":
        c+=1
    elif i=="T":
        c+=1
    else:
        c=0
    if c>d:
        d=c
print(d)

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

n_max = 0
for i, x in enumerate(s):
  if x in ["A", "C", "G", "T"]:
    n_max += 1
    longest = max(longest, n_max)
  else:
    n_max = 0
    
print(longest)

Solution (Python):









import sys
input = sys.stdin.readline

S = list(input())
for i in range(len(S)):
    if S[i] != "A" and S[i] != "C" and S[i] != "G" and S[i] != "T":
        S[i] = ' '
S2 = "".join(S)
L_ans = list(map(lambda x: len(x), S2.split()))

if L_ans:
    print(max(L_ans))
else:
    print(0)

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

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

Solution (Python):

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()

Solution (Python):
import re

print(sorted([len(s) for s in re.split('[^ATGC]',input())],reverse=True)[0])

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

print(ans)

Solution (Python):
S = input()

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


print(count)

Solution (Python):
import re
sin = input()
match = re.findall(r'[ACTG]+',sin)
m_len = [len(m) for m in match]
print(max(m_len if m_len else '0'))

Solution (Python):
X = str(input())
Y = 'ACGT'
X += "*"
sm = 0
ans = 0


for x in X:
    if x in ('A', 'C', 'G', 'T'):
        sm += 1
    else:
        ans = max(ans, sm)
        sm = 0
print(ans)

Solution (Python):
S=input()
m=0
count=0
for s in S:
    if s in 'A':count+=1
    elif s in 'C':count+=1
    elif s in 'G':count+=1
    elif s in 'T':count+=1
    else:count=0
    m=max(m,count)
print(m)

Solution (Python):
S = input()
ans = 0
l = ["A", "T", "C", "G"]
length = len(S)
for i in range(length):
    if S[i] in l:
        temp = 1
        for j in range(i + 1, length):
            if S[j] in l:
                temp += 1
            else:
                break
        ans = max(temp, ans)
print(ans)

Solution (Python):
S=input()

ans = 0
count = 0
for i in S:
    if i == 'A' or i == 'T' or i == 'C' or i == 'G':
        count += 1
    else:
        if ans < count:
            ans = count
        count = 0
if ans < count:
    ans = count
print(ans)

Solution (Python):
S = input()
ACGT = ['A', 'C', 'G', 'T']
res = 0
idx = 0
while idx < len(S):
    if S[idx] in ACGT:
        tmp = S[idx]
        while idx + 1 < len(S) and S[idx+1] in ACGT:
            tmp += S[idx+1]
            idx += 1
        if res < len(tmp):
            res = len(tmp)
    idx += 1
print(res)

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

for i, s_i in enumerate(s):
  if s_i in acgt:
    counter+=1
  else:
    ans = max(ans, counter)
    counter=0
    
  if i==len(s)-1:
    ans = max(ans, counter)
    counter=0
    
print(ans)

Solution (Python):
origin = input()
lst = ['A', 'T', 'G', 'C']
ans = 0
cnt = 0
for s in origin:
    if s in lst:
        cnt +=1
        if ans <= cnt:
            ans = cnt
    else:
        cnt = 0
print(ans)

Solution (Python):
L=['A','C','G','T']
s=input()
ans=[]
for i in range(len(s)):
    if s[i] in L:
        j=i
        while s[j] in L:
            j+=1
            if j==len(s):
                break
        ans.append(len(s[i:j]))
print(0 if len(ans)==0 else max(ans))

Solution (Python):
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)
    max_length=max(max_length,1)
      
print(max_length)

Solution (Python):
S = input()

max_length = 0
length = 0
for s in S:
    if s in ["A", "C", "G", "T"]:
        length += 1
    else:
        if length > max_length:
            max_length = length
        length = 0
if length > max_length:
        max_length = length
print(max_length)

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

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

Solution (Python):
s = input().strip()
smax = 0
c = 0
for i in s:
    if i == 'A' or i == 'T' or i == 'C' or i == 'G':
        c += 1
    else:
        if smax < c:
            smax = c
        c = 0
if smax < c:
    smax = c
print(smax)

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

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

Solution (Python):
import re
S = input()
s = re.split('[BDEFHIJKLMNOPQRSUVWXYZ]',S)
print(max(map(len,s)))

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

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

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

Solution (Python):
import sys
from collections import deque
from itertools import *


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()

ans = 0
temp = 0
for s_s in s:
    if s_s in 'ACGT':
        temp += 1
    else:
        temp = 0
    ans = max(ans, temp)
print(ans)

Solution (Python):
S = input()

dp = [0] * (len(S)+1)

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

for i in range(1,len(S)+1) :
   if S[i-1] in acgt:
       dp[i] = dp[i-1] + 1
   else:
       dp[i] = 0

print(max(dp))

Solution (Python):
S = input()
N = len(S)
res = 0
for i in range(N):
  if S[i] in "ACGT":
    cnt = 1
    for j in range(i+1, N):
      if S[j] in "ACGT":
        cnt += 1
      else:
        break
    res = max(res, cnt)

print(res)

Solution (Python):
s=input()
tar="ACGT"
res=0
ans=0
for ch in s:
    if ch in tar: ans+=1
    else:
        if ans>res: res=ans
        ans=0
if ans>res: res=ans
print(res)

Solution (Python):
s = input()
a = ['A','C','G','T']
c = 0
j = 0

for i in range(len(s)):
    if s[i] in a:
        j += 1
    else:
        if j > c:
            c = j
            j = 0

if j > c:
    print(j)
else:
    print(c)

Solution (Python):
s = input()
count = maxs = 0
for ch in s:
    if ch in "ACGT":
        count += 1
        maxs = max(maxs, count)
    else:
        count = 0
print(maxs)

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

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

Solution (Python):
import re
from itertools import groupby
S = input()
S = re.sub("[ACGT]", "?", S)
ans = 0
cnt = 0
for s,l in groupby(S):
    if s=="?":
        ans = max(ans, len(list(l)))
print(ans)

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

Solution (Python):
S = input()

N = len(S)

ACGT = {"A", "C", "G", "T"}

ans = 0
for i in range(N):
    if S[i] in ACGT:
        cnt = 0
        for j in range(i, N):
            if S[j] in ACGT:
                cnt += 1
            else:
                break
        ans = max(ans, cnt)

print(ans)

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

for head in range(0, N):
  for tail in range(head, N):
    for index in range(head, tail+1):
      check = True
      if not (S[index] in ACGT):
        check = False
        break
    if check:
      ans = max(ans, tail-head+1)
print(ans)

Solution (Python):
def resolve():
    S = input()
    cnt = 0
    maxC = 0
    for s in S:
        if s in "ACGT":
            cnt += 1
            maxC = max(maxC, cnt)
        else:
            cnt = 0
    print(maxC)


resolve()

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

Solution (Python):
S = input()
N = len(S)

ans = 0
tmp = 0
for i in range(N):
    if S[i] in {'A','C','G','T'}:
        tmp += 1
    else:
        ans = max(ans, tmp)
        tmp = 0
else:
    ans = max(ans, tmp)
print(ans)

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

Solution (Python):
from itertools import combinations

s = input() 
res = [s[x:y] for x, y in combinations(range(len(s) + 1), r = 2)] 

ans = 0
t = "AGCT"

for s in res:
    if all(c in t for c in s):
        if len(s) > ans: ans = len(s);

print(ans)

Solution (Python):
s = input()
ans = ''
m = 0
for i in s:
  if i in 'ACGT':
    ans+=i
    if i==s[-1]:
      m = max(m, len(ans))
  else:
    m = max(m, len(ans))
    ans=''
print(m)

Solution (Python):
S = list(input())
N = len(S)

ACGT = ['A','C','G','T']
tmp = 0
X = []

for i in range(N):
    if S[i] in ACGT:
        tmp += 1
    else:
        X.append(tmp)
        tmp = 0

X.append(tmp)
print(max(X))

Solution (Python):
import sys
import itertools

import time
import math
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

S = input()


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

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

Solution (Python):
s=input()
x="ATCG"
mx=0
i=0
sm=0
while i < len(s):
    if s[i] in x:
        sm+=1
        if sm>mx:mx=sm
    else: sm=0
    i+=1
print(mx)

Solution (Python):
S = input()
T = "ACGT"
ans = 0

i = 0
while i < len(S):
    if S[i] in T:
        temp = 1
        for j in range(i+1, len(S)):
            if S[j] in T:
                temp += 1
            else:
                break
        ans = max(ans, temp)
        i += 1
    else:
        i += 1

print(ans)

Solution (Python):
s=input()
x="ATCG"
mx=0
i=0
sm=0
while i < len(s):
    if s[i] in x:
        sm+=1
        if sm>mx:mx=sm
    else: sm=0
    i+=1
print(mx)

Solution (Python):
s=input()
l = set()
check = set(['A','G','C','T'])
for i in range(len(s)):
  for j in range(i+1,len(s)+1):
    
    if len(set(s[i:j]) | check) == 4:
      l.add(j-i)
if len(l) == 0:
  print(0)
else:
  print(max(l))

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

Solution (Python):
s = raw_input()
a = set(list('ACGT'))
j = 0
i = 0
r = 0
while( j < len(s)):
	if s[j] not in a:
		j += 1
		i = j 
	else:
		while(j < len(s) and s[j] in a): j+=1
		r = max(r, j - i )
		i = j
print r

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

Solution (Python):
s = input()
output = 0
ACGT = set(["A","G","C","T"])
tmp = 0
for i in s:
  if i not in ACGT:
    tmp = 0
  else:
    tmp += 1
  if tmp > output:
    output = tmp
  
print(output)

Solution (Python):
s = input()
n = 0
ans = 0
for i in s:
  if i in "ATCG":
    n += 1
    ans = max(ans,n)
  else:
    n = 0

print(ans)

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) for c in S[i:j+1]):
      ans = max(ans,j+1-i)
print(ans)

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

Solution (Python):
S = input()
S = "".join(list(S.replace("A","*").replace("C","*").replace("T","*").replace("G","*")))
count = 0
if S.count("*"*10) == 1:
  count = 10
elif S.count("*"*9) == 1:
  count = 9
elif S.count("*"*8) == 1:
  count = 8
elif S.count("*"*7) == 1:
  count = 7
elif S.count("*"*6) == 1:
  count = 6
elif S.count("*"*5) == 1:
  count = 5
elif S.count("*"*4) >= 1:
  count = 4
elif S.count("*"*3) >= 1:
  count = 3
elif S.count("*"*2) >= 1:
  count = 2
elif S.count("*"*1) >= 1:
  count = 1
else:
  count = 0
print(count)

Solution (Python):
S = input()
ans = 0
l = 0
for c in S:
  if c in 'ATCG':
    l += 1
    ans = max(ans, l)
  else:
    l = 0
print(ans)

Solution (Python):
s=0
S=list(input())
c=len(S)
if S[-1]=="A" or S[-1]=="G" or S[-1]=="C" or S[-1]=="T":
  k=1
else:
  k=0
for i in range(c-1):
  for j in range(i+1,c+1):
    if j-i<=k:
      continue
    t=set(S[i:j])
    if "A" in t:
      s+=1
    if "C" in t:
      s+=1
    if "T" in t:
      s+=1
    if "G" in t:
      s+=1
    if s==len(t):
      k=j-i
    s=0
print(k)

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

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

Solution (Python):
def main():
    s = input()
    max_len = 0
    length = 0

    s = list(s)
    s.append('')

    for i in s:
        if i in ['A', 'C', 'G', 'T']:
            length += 1
        else:
            if length > max_len:
                max_len = length
                length = 0

    print(max_len)


if __name__ == '__main__':
    main()

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

Solution (Python):
s = input()
ans = 0
for i in range(len(s)):
    for j in range(i + 1, len(s) + 1):
        if set(s[i:j]).issubset('ACGT'):
            ans = max(ans, j - i)
print(ans)