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



Sample input:
ATCODER


Sample output:
3

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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(N)
print(max(N))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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)

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
import re

s = input()

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
import re

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
S = list(input())


#print(S)



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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
import re

s = input()
n = len(s)
res = 0
for i in range(0, n):
    j = i
    tempres = 0
    while j < n and (s[j] == "A" or s[j] == "G" or s[j] == "C" or s[j] == "T"):
        j += 1
        tempres += 1
    res = max(res, tempres)

print(res)

Submission status: Accepted

Solution code:
def func():
    S = input()

    target = ["A", "G", "C", "T"]
    mx = 0
    count = 0
    for ch in S:
        if ch in target:
            count += 1
        else:
            mx = max(mx, count)
            count = 0
    
    mx = max(mx, count)
    print(mx)


if __name__ == '__main__':
    func()

Submission status: Accepted

Solution code:
S = list(input().strip())
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)

Submission status: Accepted

Solution code:
s=input()

a=set("ACGT")

ans=0
b=[0]

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

print(max(b))

Submission status: Accepted

Solution code:
s= input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

max_len = 0
memo_len = 0
flag = True

for i in range(len(S)):
    if S[i]=="A" or S[i]=="T" or S[i]=="G" or S[i]=="C":
        if flag == True:
            memo_len += 1
        else:
            memo_len = 1
            flag = True
    else:
        if max_len < memo_len:
            max_len = memo_len
        flag = False
        
if max_len < memo_len:
    max_len = memo_len
print(max_len)

Submission status: Accepted

Solution code:
S = input()
S = S.replace("C","A")
S = S.replace("G","A")
S = S.replace("T","A")
ren = 0
ans = 0
for i in range(len(S)):
    if S[i] == "A":
        ren += 1
        if ans <= ren:
            ans = ren
    else:
        ren = 0
print(ans)

Submission status: Accepted

Solution code:
s = input().strip()
n = len(s)
res = 0
left = 0
right = 0
while left < n:
    if s[left] not in ['A', 'T', 'C', 'G']:
        left += 1
        continue
    right = left + 1
    while right < n:
        if s[right] in ['A', 'T', 'C', 'G']:
            right += 1
        else:
            break
    res = max(res, right - left)
    left = right
print(res)

Submission status: Accepted

Solution code:
S = input()
ans = 0
max = 0
for i in range(len(S)):
	if S[i] in 'ACGT':
		ans += 1
	else:
		if max < ans:
			max = ans
		ans = 0
if max < ans:
	print(ans)
else:
	print(max)

Submission status: Accepted

Solution code:
S = input()
ans = 0
count = 0
for s in S:
    if s in 'ACGT':
        count += 1
    else:
        ans = max(ans, count)
        count = 0
else:
    ans = max(ans, count)
print(ans)

Submission status: Accepted

Solution code:
import re
S = input()
S = map(len, re.sub('[^ACGT]', ',', S).split(','))
print(max(S))

Submission status: Accepted

Solution code:
str = list(input())
n = len(str)
max = 0
counter = [0,0,0]
for i in range(n):
  if 'A' in str[i] or 'T'in str[i] or 'C' in str[i]or 'G'in str[i]:
    counter.insert(i, counter[i] + 1)
  else:
    counter.append(0)
  

con = 0;    
for i in range(n+1):
  if counter[i] == 1:
    con += 1
    continue
  else :
    if con > max :
      max = con
      con = 0
    
print(max)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
i=0
li = [0]
num = 0
while i<=len(s)-1:
    
    s1 = ["A","C","G","T"]
    
    if s[i] in s1 :
        num += 1
        i += 1
        li.append(num)
    elif s[i] not in s1 :
        num = 0
        i += 1
        
print(max(li))

Submission status: Accepted

Solution code:
s=input()

c=0
t=0
for i in s:
  if i in "ACGT":
    t+=1
    c=max(c,t)
  else:
    t=0
print(c)

Submission status: Accepted

Solution code:
s = str(input())
s +='0'
result = [0]
i = 0
counter = 0
while i+counter < len(s):
    counter = 0
    h = 1
    while i + counter < len(s) and h == 1:
        if s[i+counter] == 'A' or s[i+counter] == 'T' or s[i+counter] == 'G' or s[i+counter] == 'C':
            counter += 1
        else:
            result.append(counter)
            i += counter +1
            h = 0
print(max(result))

Submission status: Accepted

Solution code:
s = input()

s += "X"
pat = ["A", "C", "G", "T"]
mx = 0
count = 0

for i in range(len(s)):
    if s[i] in pat:
        count += 1
    else:
        if count > mx:
            mx = count
        count = 0

print(mx)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
S = list(str(input()))
atgc = ["A","T","G","C"]
cout = 0
a = [0]
for i in range(len(S)):
    if S[i] in atgc:
        cout+=1
    else: 
        if cout>0:
            a.append(cout)
            cout = 0
a.append(cout)
ans = max(a)
print(ans)

Submission status: Accepted

Solution code:
s = list(input())
s.append('end')
lst = ['A', 'T', 'G', 'C']
max_len = 0
cnt = 1
for i in range(len(s)-1):
    if s[i] in lst:
        if s[i+1] in lst:
            cnt += 1
        else:
            if max_len < cnt:
                max_len = cnt
            cnt = 1
print(max_len)

Submission status: Accepted

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

for i in range(len(s)):
    flag = True
    tmp=0
    for j in range(i,len(s)):
        if s[j] not in ACGT:
            flag = False
            break
        tmp += 1
    ans=max(ans,tmp)

print(ans)

Submission status: Accepted

Solution code:
S=input()
a=0
for i in range(len(S)):
  b=0
  for j in range(i,len(S)):
    if S[j]=='A' or S[j]=='C' or S[j]=='G' or S[j]=='T':
      b+=1
    else:
      break
  if b>a:
    a=b
print(a)

Submission status: Accepted

Solution code:
s= input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
L=['A','T','G','C']
ans=0
M=0
for i in range(len(s)):
  if s[i] in L:
    ans += 1
  else:
      if ans > M:
          M = ans
          ans = 0
if ans > M:
    M = ans
    ans = 0
print(M)

Submission status: Accepted

Solution code:
s=list(input())
acgt=['A','C','G','T']

ans=0
for i in range(len(s)):
  for j in range(i+1,len(s)+1):
    cnt=0
    for tmp in s[i:j]:
      if tmp not in acgt:
        break
      cnt+=1
    ans=max(ans,cnt)
print(ans)

Submission status: Accepted

Solution code:
def main():
    S = input()

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

    print(ans)



main()

Submission status: Accepted

Solution code:
s = input()
m = 0
count = 0

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

Submission status: Accepted

Solution code:
s = input()
score = 0
count = 0

for i in range(len(s)):
    if s[i] in "ACGT":
        score += 1
        count = max(count,score)
    else:
        score = 0

print(count)

Submission status: Accepted

Solution code:
s=input()
ACGT=['A','C','T','G']

count=0
max_count=0
for i in range(len(s)):
    if s[i] in ACGT:
        count+=1
        max_count=max(count, max_count)
    else:
        count=0
print(max_count)

Submission status: Accepted

Solution code:

s = input()
max = ''
for i in range(len(s)):
    for j in range(len(s)):
        flag = True
        judge = s[i:j+1]
        for k in judge:
            if k != "A" and k != "C" and k != "G" and k != "T":
                flag = False
                break
        if flag and len(judge) > len(max):
            max = judge
print(len(max))

Submission status: Accepted

Solution code:
S = input()
ACGT = ['A', 'C', 'G', 'T']
count = 0
max_count = 0
for w in S:
    if w in ACGT:
        count += 1
    if count > max_count:
        max_count = count
    if w not in ACGT:
        count = 0
print(max_count)

Submission status: Accepted

Solution code:
S = input()
L = ["A", "C", "G", "T"]

max_ = 0
cnt = 0
f = False
for n in range(len(S)):
    if (not f) and S[n] in L:
       cnt = 1
       f = True
    elif not f:
        pass
    elif f and S[n] in L:
        cnt += 1
    else:
        max_ = max(max_, cnt)
        cnt = 0
        f = False

print (max(max_, cnt))

Submission status: Accepted

Solution code:
s = input()
acgt = "ACGT"
c = 0
c_max = 0

for i in s:
    if i in acgt:
        c += 1
        if c > c_max:
            c_max = c
    else:
        c = 0

print(c_max)

Submission status: Accepted

Solution code:
S = list(input())
n = len(S)
m = 0
for i in range(n):
    for j in range(i + 1, n + 1):
        if j - i > m and all(s in "ACGT" for s in S[i:j]):
            m = j - i
print(m)

Submission status: Accepted

Solution code:
S = input()
L = ["A", "C", "G", "T"]

arr = []
st = ""

for s in S:
    if st and s not in L:
        st = ""
    if s in L:
        st += s
        arr.append(st)

print(max(map(len, arr)) if arr else 0)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
import re

def main():
    S = input()
    regex = r"[ATCG]*"
    matches = re.findall(regex, S)

    ans = 0
    for match in matches:
        if len(match) > ans:
            ans = len(match)
    return ans

if __name__ == '__main__':
    print(main())

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
s = input()
a = ['A', 'C', 'G', 'T'] 
i, tmp, ans = 0, 0, 0
while i < len(s):
  if s[i] in a:
    tmp += 1
    i += 1
    if tmp > ans:
      ans = tmp
  else:
    tmp = 0
    i += 1
print(ans)

Submission status: Accepted

Solution code:
s = input()
n = len(s)
prev = 0
ret = 0
for i in range(n):
    if s[i] not in ['A', 'C', 'G', 'T']:
        ret = max(ret, i - prev)
        prev = i + 1
ret = max(ret, n - prev)
print(ret)

Submission status: Accepted

Solution code:
S = input()
length = 0
tmp = 0
for i in range(len(S)):
    if S[i] == 'A' or S[i] == 'C' or S[i] == 'G' or S[i] == 'T':
        tmp += 1
    else:
        tmp = 0
    length = max(length, tmp)
print(length)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

s=input().split()
s=list(s[0])
length=len(s)
ans=0
for i in range(length):
    cnt=0
    for j in range(i, length):
        if s[j]=="A"or s[j]=="C"or s[j]=="G"or s[j]=="T":
            cnt+=1
        else:
            break
        ans=max(ans,cnt)
#ans=max(ans,cnt)
print(ans)

Submission status: Accepted

Solution code:
S = input()
a,b = 0,0
for s in S:
    if s in "ATGC":
        a += 1
    else:
        a = 0
    b = max(b,a)
print(b)

Submission status: Accepted

Solution code:
S = input()
a,b = 0,0
for s in S:
    if s == "A" or s == "T" or s == "G" or s=="C":
        a += 1
    else:
        a = 0
    b = max(b,a)
print(b)

Submission status: Accepted

Solution code:
S = input()
check = {'A', 'T', 'G', 'C'}
ans = 0
count = 0
for s in S:
    if s in check:
        count += 1
    else:
        ans = max(ans, count)
        count = 0
ans = max(ans, count)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

from collections import deque

answer = 0
queue = deque()
target = {'A','C','G','T'}
for s in S:
    if s in target:
        queue.append(s)
    else:
        answer = max(answer, len(queue))
        queue.clear()
answer = max(answer, len(queue))
print(answer)

Submission status: Accepted

Solution code:
s = input()

acgt = {"A", "C", "G", "T"}
converted = ""
for char in s:
    if char in acgt:
        converted += "1"
    else:
        converted += " "

substrs = [len(substr) for substr in converted.split()]
answer = 0 if len(substrs) < 1 else max(substrs)
print(answer)

Submission status: Accepted

Solution code:
S = list(input())
s = {'A', 'C', 'G', 'T'}
ans = pa = 0
for i in range(len(S)):
    if S[i] in s:
        pa += 1
        if pa > ans:
            ans = pa
    else:
        pa = 0
print(ans)

Submission status: Accepted

Solution code:
S = input()
def check_ACGT(char):
    for c in list(char):
        if c not in {"A","C","G","T"}:
            return False
    return True
max_len = 0
for start in range(len(S)):
    for end in range(start,len(S)):
        bubun_S = S[start:end+1]
        if check_ACGT(bubun_S):
            if len(bubun_S)>max_len:
                max_len = len(bubun_S)

print(max_len)

Submission status: Accepted

Solution code:
S = input()
ans = 0
temp = 0
for s in S:
    if s == "A" or s == "T" or s == "G" or s == "C":
        temp += 1
    else:
        temp = 0
    ans = max(ans, temp)
print(ans)

Submission status: Accepted

Solution code:
s = input()

res = 0
tmp = 0
for i in range(len(s)):
    if s[i] in 'ACGT':
        tmp += 1
    else:
        res = max(res, tmp)
        tmp = 0

    if i == len(s) - 1:
        res = max(res, tmp)

print(res)

Submission status: Accepted

Solution code:
s = input()
a = [str(c) for c in s]
before = 0
cnt = 0

for i in a:
  if i in ["A","C","G","T"]:
    cnt += 1
    if cnt > before:
        before = cnt
  else:
    cnt = 0

print(before)

Submission status: Accepted

Solution code:
s = input()
l = 0
lenmax = 0
 
for i in s:
  if i in "ACGT":
    l += 1
  else:
    lenmax = max(lenmax,l)
    l = 0
lenmax = max(lenmax,l)
print(lenmax)

Submission status: Accepted

Solution code:
s = input()
maxlen = 0
l = 0
for c in s:
    if c in 'ATGC':
        l += 1
    else:
        maxlen = max(maxlen, l)
        l = 0
maxlen = max(maxlen, l)
print(maxlen)

Submission status: Accepted

Solution code:
s=input()
ans=0
for i in range(len(s)):
    for j in range(i, len(s)):
        ss=s[i:j+1]
        if all('ATGC'.count(a) == 1 for a in ss):
            ans=max(ans,len(ss))
print(ans)

Submission status: Accepted

Solution code:
s=list(input())
ans=0
for i in range(len(s)):
    for j in range(len(s)):
        ss=s[i:j+1]
        if len(ss)==ss.count('A')+ss.count('T')+ss.count('G')+ss.count('C'):
            cnt=len(ss)
            ans=max(ans,cnt)
print(ans)

Submission status: Accepted

Solution code:
N = input()
a=0
b=0
for i in range(len(N)):
	if N[i] == 'A' or N[i] ==  'T' or N[i] ==  'C' or N[i] ==  'G' :
		a+=1
	else: 
		if a > b: b = a
		a=0

print(max(b,a))

Submission status: Accepted

Solution code:
s = input()
atgc = 'ATGC'
for x in s:
    if x not in atgc:
        s = s.replace(x, ' ')
print(max(list(map(len, s.split()))+[0]))

Submission status: Accepted

Solution code:
s = input()
n = len(s)
max_length = 0
for i in range(n):
    for j in range(i+1,n+1):
        if all(c in 'ACGT' for c in s[i:j]):
            max_length = max(max_length, j-i)
print(max_length)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re

def test():
    s = input()
    n = len(s)
    str = "[^ACGT]"
    a = []
    result = 0
    for i in range(n):
        a.append(s[i])
        b = "".join(a)
        c = re.findall(str,b)
        if c:
            a.clear()
        else:
            result = max(result,len(a))

    print(result)


if __name__ == "__main__":
    test()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
m = a = 0
for c in input():
    if c in "ATGC": m+=1
    else: a = max(a, m); m = 0
else: print(max(a, m))

Submission status: Accepted

Solution code:
s=list(map(str,input()))
for i in range(len(s)):
    s[i]='1' if (s[i]=='A' or s[i]=='C' or s[i]=='G' or s[i]=='T') else '0'
print(len(max(''.join(s).split('0'),key=len)))

Submission status: Accepted

Solution code:
s = input()

#ACGTを*に置き換え、それ以外の大文字は?に。そして?でsplitする。最も長いものを提出

s = s.replace('A','*')
s = s.replace('C','*')
s = s.replace('G','*')
s = s.replace('T','*')
# print(s)
for i in range(len(s)):
    # print(i,'番目の文字について')
    if s[i] != '*':
        # print('*になっていないので?に置き換えます')
        if i != len(s):
            s = s[:i]+'?'+s[i+1:]
        else:
            s = s[:i]+'?'
        # print('置き換えました')
    # print(s)
# print('置き換え終了',s)
sl = s.split('?')
# print('分割',sl)
sl.sort()
# print('ソート',sl)
if sl:
    print(len(sl[-1]))
else:
    print(0)

Submission status: Accepted

Solution code:
def main():
    S = input()
    count = 0
    max_count = 0
    for i in range(len(S)):
        if S[i] in "ATCG":
            count += 1
            max_count = max(max_count, count)
        else:
            count = 0
    return max_count

if __name__ == '__main__':
    print(main())