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() + '
M = 0
ret = 0
for s in S :
    if s in 'AGCT' :
        ret += 1
    else :
        M = max(M, ret)
        ret = 0
print(M)

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

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

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

Solution (Python):
s = list(input())
answer = 0
count = 0
ACGT = ["A","C","G","T"]
for c in s:
    if c in ACGT:
        count += 1
    else:
        if answer < count:
            answer = count 
        count = 0
print(max(answer,count))

Solution (Python):
S = list(input())
ans = 0
i = 0
cnt = 0
lst = ["A","C","G","T"]
for c in S:
    if c in lst:
        cnt += 1
    else:
        if ans < cnt:
            ans = cnt
        cnt = 0
if ans < cnt:
    ans = cnt
print(ans)

Solution (Python):
S = input()
ans = 0
for i in range(len(S)):
    cnt = 0
    while(i+cnt < len(S) and (S[i+cnt] == 'A' or S[i+cnt] == 'C' or S[i+cnt] == 'T' or S[i+cnt] == 'G')):
        cnt+=1
    ans = max(ans, cnt)
print(ans)

Solution (Python):
s = list(input())
ans = 0
temp_ans = 0
for i in s:
    if i == "A" or i == "C" or i == "G" or i == "T":
        temp_ans += 1
    else:
        temp_ans = 0
    ans = max(temp_ans,ans)
    
print(ans)

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

Solution (Python):
s = input()

ans = 0
tmp = 0
for i in s:
    if(i == 'A' or i == 'C' or i == 'G' or i == 'T'):
        tmp += 1
    else:
        ans = max(ans,tmp)
        tmp = 0
print(max(ans,tmp))

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

count = 0
max_count = 0

if len(S) == 1:
    if S[0] == 'A' or \
        S[0] == 'C' or \
        S[0] == 'G' or \
        S[0] == 'T':
        print("1")
        exit()
    else:
        print("0")
        exit()


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 > max_count:
            max_count = count
        count = 0

if count > max_count:
    max_count = count

print(max_count)

Solution (Python):
S=list(str(input()))
lst=['A','T','G','C']
N=len(S)
s=0
ans=0
def dp(s,ans):
  if s==N-1:
    return ans
  tmp=0
  if S[s] in lst:
    while s<=N-1 and S[s] in lst:
      s+=1
      tmp+=1
    ans=max(ans,tmp)
    if s==N:
      return ans
    else:
      return dp(s,ans)
  else:
    return dp(s+1,ans)
if N>=2: 
  print(dp(s,ans))
else:
  if S[0] in lst:
    print(1)
  else:
    print(0)

Solution (Python):
s=input()

cur=0
peek=0
length=0
for i in range(len(s)):
    if s[i] in ("A", "C", "G", "T"):
        peek=i
        l=(peek-cur)+1
        if length < l:
            length = l
    else:
        cur=i+1
        peek=i+1

print(length)

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 = list(input())
ok = ["A", "C", "G", "T"]

len_list = []
tmp = 0

for l in S:
    if l in ok:
        tmp += 1
    else:
        len_list.append(tmp)
        tmp = 0
    
len_list.append(tmp)
        
print(max(len_list))

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

print(max(ans,cnt))

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

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):
from itertools import groupby
import re
S = input()
s = re.sub(r"[ATGC]", "0", S)
g = [len(list(v)) for k, v in groupby(s) if k=="0"]
if len(g)==0:
    print(0)
else:
    print(max(g))

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

Solution (Python):
s = input()
cnt = 0
ans = 0
for i in s:
    if i != 'A' and i != 'C' and i != 'G' and i != 'T':
        cnt = 0
    else:
        cnt += 1
    ans = max(ans, cnt)

print(ans)

Solution (Python):

S = input()
SC= S.replace('C','A')
SCG = SC.replace('G','A')
SCGT = SCG.replace('T','A')
ans = 0
wk = 0
for i in range(int(len(S))):
    if SCGT[i:i+1] == 'A':
        wk += 1
    else:
        if wk >= ans:
            ans = wk
        wk =0

if wk >= ans:
    ans = wk
print(ans)

Solution (Python):
s = input()
ans = []
cnt = 0
for i in range(len(s)):
  if s[i] in set("ATCG"):
    cnt += 1
    ans.append(cnt)
  else:
    ans.append(cnt)
    cnt = 0
print(max(ans))

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

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

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

Solution (Python):
s = list(input())
tmp = 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":
                  tmp += 1
                  if ans < tmp:
                           ans = tmp
         else:
                  tmp = 0
print(ans)

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

Solution (Python):
s = input()

count = max_count = 0
for char in s:
    if char in ['A', 'T', 'G', 'C']:
        count += 1
    else:
        max_count = max(count, max_count)
        count = 0

print(max(max_count, count))

Solution (Python):
s=input()
t='ATGC'
ans=0
l=0
for x in s:
  if x in t:
    l+=1
    ans=max(ans,l)
  else:
    l=0
print(ans)

Solution (Python):
s = input()
acgt = 'ACGT'

max_len = 0
for i in range(len(s)):
    curr_len = 0
    for j in range(len(s) - i):
        if s[i + j] in acgt:
            curr_len += 1
        else:
            break
    if curr_len > max_len:
        max_len = curr_len
print(max_len)

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

Solution (Python):
import sys
from bisect import *
from collections import *
from copy import deepcopy
from datetime import *
from heapq import *
from itertools import *
from math import *
from operator import *
from pprint import *

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

def main():
    """ main """
    S = input().rstrip()
    N = len(S)
    idx = 0
    ans = 0
    tmp = 0
    while idx < N:
        if S[idx] in ['A','C','G','T']:
            tmp += 1
        else:
            ans = max(ans,tmp)
            tmp = 0
        idx += 1
    print(max(ans,tmp))

if __name__ == '__main__':
    main()

Solution (Python):
def slove():
    import sys
    import collections
    input = sys.stdin.readline
    s = str(input().rstrip('\n'))
    d = collections.defaultdict(list)
    d["A"]
    d["C"]
    d["G"]
    d["T"]
    mt = 0
    c = 0
    for i in range(len(s)):
        if s[i] in d:
            c += 1
        else:
            c = 0
        mt = max(mt, c)
    print(mt)


if __name__ == '__main__':
    slove()

Solution (Python):
def acgt(x):
  if x=="A" or x=="C" or x=="G" or x=="T":
    return True
  else:
    return False
txt=input()
ans=0
y=0
for i in range(len(txt)):
  if acgt(txt[i]):
    y+=1
  else:
    ans=max([ans,y])
    y=0
else:
  ans=max([ans,y])  
print(ans)

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

Solution (Python):
S = list(input())
s = 0
t = 0
c = {"A","C","G","T"}
for i in S:
    if i in c:
        s += 1
    else:
        s = 0
    if s > t:
        t = s
print(t)

Solution (Python):
S = input()
length = 0
ans = 0

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

Solution (Python):
s = input()

counter = 0
max_count = 0

for str_i in range(len(s)):
  
  if s[str_i] in ['A', 'C', 'G', 'T']:
    counter += 1
  else:
    max_count = max(max_count, counter)
    counter = 0

max_count = max(max_count, counter)
print(max_count)

Solution (Python):
s = input()
cnt = 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':
        cnt += 1
        if ans < cnt:
            ans = cnt
    else:
        cnt = 0
print(ans)

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


def main():
    S = input()[:-1]

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

if __name__ == '__main__':
    main()

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

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

Solution (Python):
import re;print(max(map(len,re.split("[^ACGT]+",input()))))

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

Solution (Python):


s = raw_input()
n = len(s)

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

print maxCnt

Solution (Python):
L = list(input())

count = 0
m_count = 0
for i in L:
      if i == 'A' or i == 'C' or i == 'G' or i == 'T':
            count += 1
            if count >= m_count:
                  m_count = count
      else:
            count = 0

print(m_count)

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

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

print(ans)

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

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

print(ans)

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

Solution (Python):
lst = ["A", "C", "G", "T"]
s = input()
res = 0
tmp = 0
for e in s:
    if e in lst:
        tmp += 1
    else:
        tmp = 0
    if tmp > res:
        res = tmp
print(res)

Solution (Python):
S = input()

max = 0
count = 0
for i in range(len(S)):
    if(S[i] != 'A' and S[i] != 'T' and S[i] != 'G' and S[i] != 'C'):
        if(count > max):
            max = count
        count = 0
    else:
        count += 1

if(count > max):
    max = count

print(max)

Solution (Python):
S=input()
mx=0
flag=1
for i in range(11):
    for j in range(11):
        if i>=j:
            continue
        for s in S[i:j]:
            if s not in ['A','G','C','T']:
                flag=0
        if flag:
            mx=max(len(S[i:j]),mx)
        else:
            flag=1

print(mx)

Solution (Python):
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    import re
    pattern="[A,C,G,T]+"
    cmp=re.compile(pattern)
    S=input()
    res=cmp.findall(S)
    if res:
        print(max(len(s) for s in res))
    else:
        print(0)
resolve()

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

Solution (Python):
S = list(input())
cnt = 0
max_cnt = 0

for elem in S:
    if elem in ["A", "C", "G", "T"]:
        cnt += 1
        if cnt >= max_cnt:
            max_cnt = cnt
    else:
        cnt = 0

print(max_cnt)

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

Solution (Python):
b=input()
a=[]
e=[]
for i in range(len(b)):
    for j in range(len(b)):
        c=b[i:j+1]
        if len(c) >0:
            a.append(c)

    
for j in a:     
    total=0
    for k in 'ACGT':
        d=j.count(k)
        total +=d
        if total == len(j):
            e.append(total)    

if e == []:
    print(0)
else:    
    print(max(e))

Solution (Python):
s = input()

ans = 0

i = 0
while i <= len(s) - 1:
    index = i
    length = 0
    while i <= len(s) - 1:
        if s[i] in ["A", "C", "G", "T"]:
            length += 1
            i += 1
        else:
            
            ans = max(ans, length)
            i += 1
            break


print(max(ans, length))

Solution (Python):

S = str(input())
count = 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':
        count += 1
        if ans <= count:
            ans = count
        else:
            pass
    else:
        count = 0

print(ans)

Solution (Python):
import re
print(max(map(len,re.split('[^ACGT]', input()))))

Solution (Python):
s = input()
l = len(s)
li = [0]
for i in range(l):
    for j in range(l-i):
        if all([k in ['A','C','G','T'] for k in list(s[i:i+j+1])]):
            li.append(len(s[i:i+j+1]))
print(max(li))

Solution (Python):
import re
print(max(map(len, re.findall("[ACGT]*",input()))))

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

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+1-i)
print(ans)

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

Solution (Python):

s = input()
max_length = 0
tmp_length = 0
match_char = ["A", "C", "G", "T"]
for si in s:
    if si in match_char:
        tmp_length += 1
        max_length = max(max_length, tmp_length)
    else:
        tmp_length = 0
print(max_length)

Solution (Python):
import re
S = input()
A = re.findall(r'[ATCG]+', S)

if A:
    A.sort(key=lambda x: len(x), reverse=True)
    print(len(A[0]))
else:
    print(0)

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

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

string = 'ACGT'
ans = 0
tmp = 0


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

print(ans)

Solution (Python):
ans = [0]
acgt = "ACGT"
for s in input():
  if s in acgt:
    ans[0] += 1
  else:
    ans.insert(0, 0)
print(max(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()
bs = ['A','T','C','G']
tmp = 0
can = []
for i in range(len(s)):
  if s[i] in bs:
    tmp += 1
  else:
    tmp = 0
  can.append(tmp)
print(max(can))

Solution (Python):
s=input()
l=['A','T','C','G']
nl=[0]

for n in range(len(s)):
  if s[n] in l:
    nl[-1]+=1
  else:
    nl.append(0)

print(max(nl))

Solution (Python):
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    

S=input()
ans=0
cnt=0

for i in range(len(S)):
	if S[i]=="A" or S[i]=="T" or S[i]=="C" or S[i]=="G":
		cnt+=1
		for j in range(1,len(S)-i):
			if S[i+j]=="A" or S[i+j]=="T" or S[i+j]=="C" or S[i+j]=="G":
				cnt+=1
			else:
				ans=max(cnt,ans)
				cnt=0
				break
			
	else:
		continue		
							
	ans=max(ans,cnt)
	cnt=0
			
ans=max(ans,cnt)

print(ans)

Solution (Python):
S = list(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
    else:
        if ans < count:
            ans = count
        else:
            pass
        count = 0
if ans < count:
    ans = count
else:
    pass
print(ans)

Solution (Python):
S = input()

max_num = 0
continuous_num = 0

for s in S:
    if s == 'A' or s == 'C' or s == 'G' or s == 'T':
        continuous_num += 1
        if continuous_num > max_num:
            max_num = continuous_num
    else:
        continuous_num = 0

print(max_num)

Solution (Python):
S=input()
acgt=["A", "C", "G", "T"]
count=0
max_count=0
for s in S:
    
    if s in acgt:
        count += 1
    else:
        if count > max_count:
            max_count = count
        count=0
if count > max_count:
    print(count)
else:
    print(max_count)

Solution (Python):
s = input()

ans = 0
for i in range(len(s)+1):
    for j in range(len(s)+1):
        ss = s[i:j]
        acgt = ['A', 'C', 'G', 'T']
        fl = 1
        for si in ss:
            if si not in acgt:
                fl = 0
                break
        if fl == 1 and len(ss) > 0:
            ans = max(ans, j - i)

print(ans)

Solution (Python):

s = input()
n = len(s)

acgt = 'A','C','G','T'
ans = 0

for i in range(n):
    for j in range(n-i):
        S = s
        S = S[j:j+i+1]
        t = 0
        for k in range(len(S)):
            if S[k:k+1] not in acgt:
                break
            if k+1 == len(S):
                t = len(S)
                ans = max(ans,t)
print(ans)

Solution (Python):
S=input()
N=len(S)
temp=[0]
for i in range(N):
  if S[i]=='A' or S[i]=='T' or S[i]=='G' or S[i]=='C':
    temp[-1]+=1
  else:
    temp.append(0)
    
print(max(temp))

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

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

Solution (Python):
S = input()

max_cnt = 0
tmp_cnt = 0
for i in range(len(S)):
    if S[i] in 'ACGT':
        tmp_cnt += 1
    else:
        max_cnt = max(max_cnt, tmp_cnt)
        tmp_cnt = 0

print(max(max_cnt, tmp_cnt))

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

max_ACGT = 0
count = 0
for i in range(len(S_list)):
    if S_list[i] in ACGT_list:
        count += 1
        if max_ACGT < count:
            max_ACGT = count
        else:
            pass
    else:
        count = 0
print(max_ACGT)

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

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

ans = 0
for i in range(len(S)):
    if S[i] in acgt:
        cnt = 1
        i += 1
        while 1:
            if i == len(S):
                break
            if not S[i] in acgt:
                break
            i += 1
            cnt += 1
        if ans < cnt:
            ans = cnt
print(ans)

Solution (Python):
D = ["A","T","G","C"]
S = input().strip()
N = len(S)
cnt = 0
for k in range(N):
    for i in range(k+1):
        ind = 1
        for j in range(i,i+N-k):
            if S[j] not in D:
                ind = 0
                break
        if ind == 1:
            cnt = N-k
            break
    if ind==1:break
print(cnt)

Solution (Python):
S=input()
N=[0]*len(S)
 
for i in range(len(S)):
  if S[i]=="A" or S[i]=="C" or S[i]=="G" or S[i]=="T":
    N[i]=N[i-1]+1

print(max(N))

Solution (Python):
str=input()
count=0
max_count=0
for i in str:
    if i=='A' or i=='C'or i=='G'or i=='T':
        count=count+1
    else:
        if max_count<count:
            max_count=count
        count=0
if max_count<count:
    max_count=count
print(max_count)

Solution (Python):
S=input()
N=[0]*len(S)

for i in range(len(S)):
  if S[i]=="A" or S[i]=="C" or S[i]=="G" or S[i]=="T":
    N[i]=N[i-1]+1

print(max(N))

Solution (Python):
word = input()

ATCG =['A', 'T', 'C', 'G']
count = 0
countlist = []

for x in word:
    if x in ATCG:
        count+=1
    elif count!=0:
        countlist.append(count)
        count = 0

countlist.append(count)
print (max(countlist))

Solution (Python):
s = input()

ans = [0]
cnt = 0
for i in s:
    if (i == "A" or i == "C" or i == "G" or i == "T"):
        cnt+=1
    else:
        if (cnt > 0):
            ans.append(cnt)
            cnt = 0
ans.append(cnt)
print(max(ans))

Solution (Python):


s = list(input())

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

s.append("X")

c = 0
c_max = 0
for i in range(len(s)):
    if s[i] in AGCT:
        c += 1
    else:
        c_max = max(c_max, c)
        c = 0

print(c_max)

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

Solution (Python):
s=input()
ans=0
cnt=0
for i in range(len(s)):
    if s[i] in "ATGC":
        cnt+=1
        ans=max(cnt,ans)
    else:
        cnt=0
print(ans)

Solution (Python):
S = input()

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

print(ans)

Solution (Python):
S = input()

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

print(ans)

Solution (Python):
s = input()
max_len = -1
for i in range(len(s)):
  count = 0
  while (i+count<len(s) and s[i+count] in ['A','T','G','C']):
    count+=1
  if count > max_len:
    max_len = count
print(max_len)

Solution (Python):
n = input()

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

num = 0
ct = 0
for i in n:
    if i in l:
        ct += 1
    else:
        num = max(num,ct)
        ct = 0

print(max(num,ct))

Solution (Python):
def makelist(n, m):
    return [[0 for i in range(m)] for j in range(n)]

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

Solution (Python):
import re
print(max(map(len,re.findall("[ACGT]*",input()))))

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

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

print(max(ans,cnt))

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

Solution (Python):
import re

s = input()

l = re.split("[^ACGT]+", s)
answer = max(len(_) for _ in l)
print(answer)

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

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

long_record = 0
for car in s:
  if car in ACGT:
    temp += 1
  else:
    if long_record < temp:
      long_record = temp
    temp = 0
print(max(long_record, temp))

Solution (Python):
import re

S = input()
print(max(len(s) for s in re.split("[^AGCT]", S)))

Solution (Python):
S = input()

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

print(ans)

Solution (Python):
S = input()

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

print(ans)

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

ans = 0
for i in range(N):
    for j in range(i + 1, N + 1):
        for s in S[i:j]:
            if s not in "ACGT":
                break
        else:
            ans = max(ans, j - i)
print(ans)

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

Solution (Python):
S_temp = input()
S = [c for c in S_temp]
count = [0] * (len(S)+1)
count[0] = 0
for i in range(len(S)):
  if S[i] == 'A' or S[i] == 'C' or S[i] == 'G' or S[i] == 'T':
    count[i+1] = count[i] + 1
print(max(count))

Solution (Python):
l=[c for c in input()]
l1=[-1]
l2=[]
for i,j in enumerate(l):
  if j not in 'ACGT':
    l1.append(i)
l1.append(len(l))
for i in range(len(l1)-1):
  l2.append(l1[i+1]-l1[i]-1)
print(max(l2))

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

Solution (Python):
if __name__ == '__main__':
    S = str(input())
    Bases = ['A', 'T', 'G', 'C']
    len_max = 0
    len_start = 0
    for i, s in enumerate(S):
        if s not in Bases:
            len_max = max(len_max, i - len_start)
            len_start = i+1
    len_max = max(len_max, i - len_start+1)
    
    print(len_max)

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

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

Solution (Python):
s = input()

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

Solution (Python):
atgc = ['A', 'T', 'G', 'C']

c = 0
ans = 0
for s in input():
  if s in atgc:
    c += 1
    ans = max(ans, c)
  else:
    c = 0
print(ans)

Solution (Python):
s=input()

temp=0
templi=[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:
    templi.append(temp)
    temp=0
templi.append(temp)

print(max(templi))

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

Solution (Python):
S = input()

ans = 0

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

print(ans)

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

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

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

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






count = 0
max = 0
for _ in range(len(S)):
    if(S[_] == 'A' or S[_] == 'C' or S[_] == 'G' or S[_] == 'T'):
        count = count + 1

        if(count > max): max = count
    else:
        count = 0

print(max)

Solution (Python):
s = input().replace('A','
ans,count = 0,0
for i in s:
    if i == '
        count += 1
    else:
        ans = max(ans,count)
        count = 0
print(max(ans,count))

Solution (Python):
s = input()
cnt = [0]*(len(s))
for i in range(len(s)):
  for j in range(i,len(s)):
    if s[j] in ["A","C","G","T"]:
      cnt[i] += 1
    else:
      break

print(max(cnt))

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

Solution (Python):
import re

s = input()
pat = r"[ACGT]+"
atgc = re.findall(pat, s)
ress = []
for i in atgc:
    ress.append(len(i))
if ress == [""] or ress == []:
    print(0)
else:
    print(max(ress))