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()
cs = []
c=0
st=0
for i in range(len(s)):
    if st == 0:
        if s[i] == "A" or s[i]=="T" or s[i] == "C" or s[i]=="G":
            st = 1
            c += 1
    elif st == 1:
        if s[i] == "A" or s[i]=="T" or s[i] == "C" or s[i]=="G":
            c += 1
        else:
            st = 0
            cs.append(c)
            c=0
cs.append(c)
print(max(cs))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

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

num_list = [-1]
for i in range(len(S)):
  if S[i] not in ACGT:
    num_list.append(i)

num_list.append(len(S))

dif_list = []
for i in range(len(num_list)-1):
  dif_list.append(num_list[i+1]-num_list[i])
  
print(max(dif_list)-1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

max_count = 0

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

print(max_count)

Submission status: Accepted

Solution code:
a = input()
maxima=0
c=0
for i in range(0,len(a)):
	if(a[i:i+1]=="A" or a[i:i+1]=="T" or a[i:i+1]=="G" or a[i:i+1]=="C"):
		c=c+1
	else:
		if(c>maxima):
			maxima=c
			c=0
		else:
			c=0
if(c>maxima):
	maxima=c
print(maxima)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=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 count>ans:
            ans=count
    else:count=0
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#122B
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 = count + 1
        if count > max_c:
            max_c = count
        else:
            pass
    else:
        count = 0

print(max_c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

s = input()
ls = len(s)
part_s = set( [s[i:j+1] for i in range(ls) for j in range(ls)  ])
part_s = [ i for i in part_s if set(list(i)) | set(["A","T","C","G"]) == set(["A","T","C","G"])]
if part_s == []:
    print(0)
else:
    print(max(map(len,part_s)))

Submission status: Accepted

Solution code:
s=input()

h = 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
        h=max(h,tmp)
    else:
        tmp=0
print(h)

Submission status: Accepted

Solution code:
"""
n = int(sys.stdin.readline())
a, b = map(int, sys.stdin.readline().split())
c = list(map(int, sys.stdin.readline().split()))
s = [list(map(int,list(sys.stdin.readline()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

a = 100
b = 0.987654321
print('{0:06d}-{1:6f}'.format(a,b))  # 0埋め, 小数点出力桁指定時のときの出力
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)


mod = 1000000007

if __name__ == "__main__":
    target = list("ACGT")
    s = sys.stdin.readline()
    l = 0
    ml = 0
    for w in s:
        if w in target:
            l += 1
        else:
            if ml < l:
                ml = l
            l = 0
    print(ml)

Submission status: Accepted

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


AGTC = ['A', 'G', 'T', 'C']
part_l = []
for i in range(N):

        if S[i] in AGTC:
                if i == 0:
                        part = [S[i]]
                elif S[i-1] in AGTC:
                        part.append(S[i])
                else:
                        part = [S[i]]
        else:
                if i == 0:
                        part = []
                elif S[i-1] in AGTC:
                        part_l.append(part)
                        part = []
part_l.append(part)

max_part = []          
for part in part_l:
        if len(part) > len(max_part):
                max_part = part

print(len(max_part))

Submission status: Accepted

Solution code:
S = input()

len = 0
ans = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
num = []
lists = ["A","C","G","T"]
count = 0

for i in range(len(s)):
    if s[i] in lists:
        count +=1
    else:
        num.append(count)
        count = 0
else:
    num.append(count)
print(max(num))

Submission status: Accepted

Solution code:
s = input()
z = ''
ans = 0
for i in range(len(s)):
    if s[i] in 'ACGT':
        ans = max(ans, 1)
        for j in range(i+1, len(s)):
            if s[j] in 'ACGT':
                ans = max(ans, j-i+1)
            else:
                break
    else:
        continue
print(ans)

Submission status: Accepted

Solution code:
from sys import stdin

S = stdin.readline().rstrip()

count = 0
count_list = []
N = len(S)
for i in range(0,N):
    while S[i] == 'A' or S[i] == 'T' or S[i] == 'G' or S[i] == 'C':
        count += 1
        if i == N - 1:
            break
        i += 1
    count_list.append(count)
    count = 0

count_list.sort()
print(count_list[-1])

Submission status: Accepted

Solution code:
s = input()
f = False
c = 0
cand = [0]
for item in s + "*":
    if not f and item in ["A", "T", "G", "C"]:
        f = True
        c = 1
        continue
    if f:
        if item in ["A", "T", "G", "C"]:
            c += 1
        else:
            cand.append(c)
            c = 0
            f = False
print(max(cand))

Submission status: Accepted

Solution code:
S = list(str(input()))
counter = [0]

for i in range(len(S)):
	if S[i] in "ATGC":
		counter[-1] += 1
	else:
		counter.append(0)
print(max(counter))

Submission status: Accepted

Solution code:
result = 0
cnt = 0
b = list(input())
for str in b:
    if str == "A" or str == "T" or str == "C" or str == "G":
        cnt += 1
        result = max(result,cnt)
    else:
        cnt = 0
print(result)

Submission status: Accepted

Solution code:
s=input()

char_list=['A','C','G','T']
cnt=0
max=0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = list(input())
#print(X)
ans=0
anss=[]
for i in X:
  if i in ['A','C','G','T']:
    ans+=1
#    print(i)
  else:
    ans = 0
  anss.append(ans)

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

Submission status: Accepted

Solution code:
# AtCorder

s = input()

a = "ACGT"
v = 0
ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
a = input()+"a"
num=0
b=[]
for i in a:
  if i in 'ATGC':
    num+=1
  else:
    b.append(num)
    num=0
print(max(b))

Submission status: Accepted

Solution code:
S = input()
N = len(S)
ret = 0

for i in range(N):
    for j in range(i + 1, N+1):
        f = True
        for s in S[i:j]:
            if s not in 'ACGT':
                f = False
                break

        if f:
            ret = max(ret, j - i)

print(ret)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = str(input())
max = 0
for i in range(len(S)):
    k = 0
    if not(S[i] in {'A','T','G','C'}):
        continue
    k = 1
    for j in range(i+1,len(S)):
       if S[j] in {'A','T','G','C'}:
           k+=1
       else:
           break

    if k > max:
        max = k

print(max)

Submission status: Accepted

Solution code:
import re

#入力取得
s = input()

match = re.findall('[ACGT]*', s)


ans = 0

for m in match:
    ans = max(ans, len(m))

print(ans)

Submission status: Accepted

Solution code:
s=input()
ans=0
crr=0
words=['A','C','T','G']
for ss in s:
    if ss in words:
        crr+=1
    else:
        crr=0
    ans=max(crr,ans)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def abc():
    import re
    s = input().rstrip()
    g = re.findall(r'[ATCG]*', s)
    print(max([len(x) for x in g]))


abc()

Submission status: Accepted

Solution code:
S = input()
# print(S)
# print(len(S))
list = []
for i in range(len(S)):
    if(S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T"):
        list.append(i)
# print(list)
NUM = []
for j in range(len(list)):
    num = 1
    for k in range(j,len(list)-1):
        # print("k:",k)
        # print("list[j+1]:",list[j+1], "list[j]:", list[j])
        # print("list[k+1]:",list[k+1], "list[k]:", list[k])
        if(list[k+1] - list[k] == 1):
        # if(list[j+1] - list[j] == 1):
            num += 1
            # print("k1:",k)
        else:
            NUM.append(num)
            # print("NUM1:", NUM)
            break
    else:
        NUM.append(num)
        # print("NUM2:", NUM)

# print("NUM3:",NUM)
if(len(NUM) == 0):
    print(0)
else:
    print(max(NUM))

Submission status: Accepted

Solution code:
s = input()
l = len(s)
a = [0]*l
for i in range(l):
    if s[i] == "A" or s[i] =="T" or s[i] =="C" or s[i] =="G":
        a[i] = 1
m = 0
if a[0] == 1:
  m = 1
for i in range(1,l):
    a[i] = (a[i-1]+1)*a[i]
    if m < a[i]:
        m = a[i]

print(m)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

input = sys.stdin.readline

def main():
    S = list(input().strip())
    n = 0
    max_n = 0
    for c in S:
        if c == 'A' or c == 'C' or c == 'G' or c == 'T':
            n += 1
        else:
            n = 0
        max_n = max(max_n, n)
    print(max_n)

main()

Submission status: Accepted

Solution code:
S = input()
count = [0 for _ in range(len(S))]
for i, s_i in enumerate(S):
  if s_i in ['A', 'G', 'C', 'T']:
    if i == 0:
      count[i] = 1
    else:
      count[i] = count[i-1] + 1
  else:
    count[i] = 0
    
print(max(count))

Submission status: Accepted

Solution code:
s1 = input()

r1 = 0
n1 = 0
for i1 in range(len(s1)):
    if s1[i1] == "A" or s1[i1] == "T" or s1[i1] == "C" or s1[i1] == "G":
        n1 += 1
    else:
        r1 = max(n1,r1)
        n1 = 0
r1 = max(n1,r1)

print(r1)

Submission status: Accepted

Solution code:
import math
S = input()
l = len(S)
cs = ["A","G","C","T"]
ma = 0
for i in range (l):
    for j in range(i,l+1):
        sub = S[i:j]

        for c in sub:
            if c not in cs:
                break
        else:
            if len(sub) > ma:
                ma = len(sub)
print(ma)

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

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

Submission status: Accepted

Solution code:
s_li = list(input())
n = len(s_li)
ans = []
if "A" in s_li or "C" in s_li or "G" in s_li or "T" in s_li:
    co = 0
    for s in s_li:
        if s in ["A","C","G","T"]:
            co += 1
        else:
            ans.append(co)
            co = 0
    ans.append(co)
else:
    ans.append(0)
print(max(ans))

Submission status: Accepted

Solution code:
s = input()
cnt = 0
cnt_list = [0]*len(s)
for idx,i in enumerate(s):
    if i in 'ACTG ':
        cnt +=1
    else:
        cnt = 0
    cnt_list[idx] = cnt
print(max(cnt_list))

Submission status: Accepted

Solution code:
s = input()
lis=[]
for i in range(len(s)):
    if s[i] not in "ACGT":
        lis.append(i)
len_max = 0
for i in range(len(lis)-1):
    len_max = max(len_max,lis[i+1]-lis[i]-1)

if lis != []:
    print(max(len_max,lis[0],len(s)-lis[-1]-1))
else:
    print(len(s))

Submission status: Accepted

Solution code:
s = input()
ans = 0
for i in range(len(s)):
    for j in range(i, len(s)):
        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()
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 count>ans:
            ans=count
            count=0
else:
    if count>ans:
        ans=count
print(ans)

Submission status: Accepted

Solution code:
s = input()
a = 0
b = 0
for i in s:
  if i in 'ATCG':
    a += 1
  else:
    b = max(a, b)
    a = 0
print(max(a,b))

Submission status: Accepted

Solution code:
s = input()
a=b=0
for i in s:
    if i in 'ATCG':
        a += 1
    else :
        b = max(a,b)
        a = 0

print(max(a,b))

Submission status: Accepted

Solution code:
S = input()
A = B = 0
for x in S:
  if x in 'ATCG':
    A = A + 1
  else:
    B = max(A,B)
    A = 0
print(max(A,B))

Submission status: Accepted

Solution code:

s = input()
words = ["A","T","C","G"]

counter = 0
countMax = 0
for i in s:
    if i in words:
        counter += 1
    else:
        countMax = max(countMax,counter)
        counter = 0
else:
    countMax = max(countMax,counter)

print(countMax)

Submission status: Accepted

Solution code:
b=input()
num=0
m=0

for i in b:
    if(i=="A"):
        num+=1
    elif(i=="T"):
        num+=1
    elif(i=="G"):
        num+=1
    elif(i=="C"):
        num+=1
    else:
        num=0

    m=max(m,num)


print(m)

Submission status: Accepted

Solution code:
N=input()
N=N.replace("A","0")
N=N.replace("T","0")
N=N.replace("G","0")
N=N.replace("C","0")
n=0
while n < 11:
  if "0"*(10-n) in N:
    print(10-n)
    break
  elif n==10:
    print(0)
    break
  else:
    n=n+1

Submission status: Accepted

Solution code:
s = input()
slt = list(s)

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

cntlt = list()
cnt = 0
for i in range(0, len(slt)):
    if slt[i] in mojiretu:
        cnt += 1
    else:
        cntlt.append(cnt)
        cnt = 0
else:
    cntlt.append(cnt)

print(max(cntlt))

Submission status: Accepted

Solution code:
S=[int(c in "ACGT") for c in input()]
for i in range(1,len(S)):S[i]=(S[i-1]+S[i])*S[i]
print(max(S))

Submission status: Accepted

Solution code:
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 "ACGT") : break
        else:
            ans = max(ans,len(S[i:j]))
print(ans)

Submission status: Accepted

Solution code:
S=input()
Slist=[]
for i in range(len(S)):
    Slist.append(int(S[i]in['A','C','G','T']))
ans=0
counter=1
for i in range(1,len(S)):
    if Slist[i]!=Slist[i-1]:
        if Slist[i-1]==1:
            ans=max(ans,counter)
        counter=1
    else:
        counter+=1
if Slist[-1]==1:
    ans=max(ans,counter)
print(ans)

Submission status: Accepted

Solution code:
s = list(input())
maxNum = 0
ans = 0
for i in s:
    if i == "A" or i == "C" or i == "G" or i == "T":
        maxNum += 1
        if ans < maxNum:
            ans = maxNum
    else:
        maxNum = 0
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
acgt = "ACGT"
S = input()
ans = 0
s = 0
for c in S:
    if c in acgt:
        s += 1
        if c == S[-1]:
            ans = max(ans, s)
    else:
        ans = max(ans, s)
        s = 0

print(ans)

Submission status: Accepted

Solution code:
acgt = "ACGT"
S = input()
ans = 0
s = 0
for c in S:
    if c in acgt:
        s += 1
    else:
        ans = max(ans, s)
        s = 0

print(max(ans, s))

Submission status: Accepted

Solution code:
t = input()
acgt = ["A", "C", "G", "T"]
 
i = 0
j = 0
for c in t:
  if c in acgt:
    i += 1
  else:
    j = max(i,j)
    i = 0
 
print(max(i,j))

Submission status: Accepted

Solution code:
s = input()
acgt = ['A','C','G','T']
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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

cnt = 0
max_ = 0

for i in s:
    if i == 'A' or i == 'C' or i == 'G' or i == 'T':
        cnt += 1
        if max_ <= cnt:
            max_ = cnt
    else:
        cnt = 0

print(max_)

Submission status: Accepted

Solution code:
mx = 0
S = input()
tmp = 0
for ch in S:
    if ch in "ATCG":
        tmp += 1
    else:
        mx = max(tmp, mx)
        tmp = 0

mx = max(tmp, mx)
print(mx)

Submission status: Accepted

Solution code:
import sys
import re

S=input()
if S.isalpha():
    pattern='[A,T,C,G][A,T,C,G][A,T,C,G][A,T,C,G]*'
    match_list=re.findall(pattern, S)
    if match_list:
        size_str=[]
        for item in match_list:
            size_str.append(len(item))
        print(max(size_str))
    else:
        pattern='[A,T,C,G][A,T,C,G][A,T,C,G]'
        match_list=re.findall(pattern, S)
        if match_list:
            print("3")
        else:
            pattern='[A,T,C,G][A,T,C,G]'
            match_list=re.findall(pattern, S)
            if match_list:
                print("2")
            else:
                pattern='[A,T,C,G]'
                match_list=re.findall(pattern, S)
                if match_list:
                    print("1")
                else:
                    print("0")

Submission status: Accepted

Solution code:
S=input()
ans=0
nucreotides=["A","C","G","T"]
i=0
p=0

while i<=len(S)-1:
    if S[i] not in nucreotides:
        p=0
        i+=1
    else:
        p+=1
        if ans<=p:
            ans=p
        i+=1
        
print(ans)

Submission status: Accepted

Solution code:
S = input()
str_list = ['A','C','G','T']
cnt = 0
ans = 0

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

Submission status: Accepted

Solution code:
b = input()
len = len(b)
ACGT = 0
MAX = 0
flag = 0
for i in range(len):
  if b[i]=="A" or b[i]=="C" or b[i]=="G" or b[i]=="T":
    ACGT += 1
  else:
    if ACGT > MAX:
      MAX = ACGT
    ACGT = 0
if ACGT > MAX:
  MAX = ACGT
print(MAX)

Submission status: Accepted

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

print(max(ans, cnt))

Submission status: Accepted

Solution code:
import re

S=input()

ans=0
for i in range(10):
  for j in range(i,10+1):
    str=S[i:j]
    if re.search(r'^[AGCT]+$' ,str):
      ans=max(ans,len(str))

print(ans)

Submission status: Accepted

Solution code:
search_char = ('A', 'T', 'G', 'C')
ans = 0
comp = 0
input_str = input()
for c in input_str:
    if c in search_char:
        comp += 1
    else:
        if ans < comp:
            ans = comp
            comp = 0
else:
    if ans < comp:
        ans = comp
print(ans)

Submission status: Accepted

Solution code:
ACGT=['A','C','G','T']
def chkAcgt(s):
    p=0
    c=s[p]
    while c in ACGT:
        p+=1
        if p>len(s)-1:
          break
        c=s[p]
    return p

def resolve():
    S=list(input())
    mx=0
    while True:
        if S[0] not in ACGT:
            S.pop(0)
        else:
            mx=max(mx,chkAcgt(S))
            del S[:chkAcgt(S)]

        if len(S)==0:
            break
    print(mx)
resolve()

Submission status: Accepted

Solution code:
targets = ['A', 'C', 'G', 'T']

S = str(input())

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


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

Submission status: Accepted

Solution code:
input_word=input()
input_word+="E"
atcg_list=["A","T","C","G"]
OK_list=[]
tmp=[]
for i,inp in enumerate(input_word):

    if inp in atcg_list:
        tmp.append(inp)
    else:
        OK_list.append(tmp)
        tmp=[]

print(max([len(ok) for ok in OK_list]))

Submission status: Accepted

Solution code:
S = input()

N = 0
cnt = 0
maxCnt = 0

while len(S) > N:
    if S[N] == "A" or S[N] == "C" or S[N] == "G" or S[N] == "T":
        N += 1
        cnt += 1
        if maxCnt < cnt:
            maxCnt =cnt
        
    else:
        cnt = 0
        N += 1

print(maxCnt)

Submission status: Accepted

Solution code:
S = input()

l = 0

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

print(l)

Submission status: Accepted

Solution code:
c = str(input())
max_count = 0
count = 0

for i in c:
	if i == 'A':
		count += 1
	elif i == 'T':
		count += 1
	elif i == 'C':
		count += 1
	elif i == 'G':
		count += 1
	else:
		if count > max_count:
			max_count = count
		count = 0

if count > max_count:
			max_count = count

print(max_count)

Submission status: Accepted

Solution code:
s = input()
a = ["A","C","G","T"]
b = [0]
count = 0

for i in s:
    if i in a:
        count += 1
    else:
        b.append(count)
        count = 0
b.append(count)
print(max(b))

Submission status: Accepted

Solution code:
S = input()

c_max = 0
cnt = 0

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

print(c_max)

Submission status: Accepted

Solution code:
S = input()

ATCG = ['A','T','C','G']
ans = [0, 0]
for s in S:
    if s in ATCG:
        ans[0] += 1
    else:
        if ans[1] < ans[0]:
            ans[1] = ans[0]
        ans[0] = 0

if ans[1] < ans[0]:
    ans[1] = ans[0]
print(ans[1])

Submission status: Accepted

Solution code:
S = input()

ATCG = ['A','T','C','G']
ans = []
pre = 0
for s in S:
    if s in ATCG:
        pre += 1
    else:
        ans.append(pre)
        pre = 0

ans.append(pre)
print(max(ans))

Submission status: Accepted

Solution code:
S = input()
cnt = 0
max_cnt = 0

for s in S:
    if s=="A" or s=="C" or s=="G" or s=="T":
        cnt += 1
        if cnt > max_cnt:
            max_cnt = cnt
    else:
        if cnt > max_cnt:
            max_cnt = cnt
        cnt = 0
        
print(max_cnt)

Submission status: Accepted

Solution code:
s = list(input())
t = ""
for l in s:
  if l == "A" or l == "C" or l == "G" or l == "T":
    t += l
  else:
    t += ","
#print(t)
list = [len(i) for i in t.split(",")]
print(max(list))

Submission status: Accepted

Solution code:
lststr = [i for i in input()]

lststr_replace = [s.replace("A", "target") for s in lststr]
lststr_replace = [s.replace("C", "target") for s in lststr_replace]
lststr_replace = [s.replace("G", "target") for s in lststr_replace]
lststr_replace = [s.replace("T", "target") for s in lststr_replace]

con = 0
maxcon = 0
for i in range(len(lststr)):
    if lststr_replace[i] == "target":
        con += 1
        if maxcon < con:
            maxcon = con
    else:
        con = 0
print(maxcon)

Submission status: Accepted

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

S = input()

replaced_S = re.sub('[^ATCG]', ' ', S)

list_S = [s for s in replaced_S.split()]

max_length = 0
for s in list_S:
    if len(s) > max_length:
        max_length = len(s)

print(max_length)

Submission status: Accepted

Solution code:
S = list(str(input()))

ans = 0
start_index = 0
for end_index in range(len(S)):
  if S[start_index] == "A" or S[start_index] == "C" or S[start_index] == "G" or S[start_index] == "T":
    if S[end_index] == "A" or S[end_index] == "C" or S[end_index] == "G" or S[end_index] == "T":
      ans = max(ans,end_index - start_index + 1)
    else:
      start_index = end_index
  else:
    start_index = end_index

print(ans)

Submission status: Accepted

Solution code:
import re
s=re.split("[^ACGT]", input())
a=[]
for i in range(len(s)):
    a.append(len(s[i]))
print(max(a))

Submission status: Accepted

Solution code:
s = list(input())

n = len(s)

cnt = 0
ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
li = list(input())

ans = 0
count = 0

for i in li:
    if  i == 'A' or i == 'C' or i == 'G' or i == 'T':

        count += 1

        ans = max(ans,count)

    else:
        count = 0

print(ans)

Submission status: Accepted

Solution code:
import re

li = re.findall("[ATGC]+", input())
res = 0
for st in li:
    le = len(st)
    if le > res:
        res = le

print(res)

Submission status: Accepted

Solution code:
code = input()
read_code = list(code)
count = 0
count_end = 0

for i in range(0, len(read_code)):
    code_count = False
    if read_code[i] == "A" or read_code[i] == "C" or read_code[i] == "G" or read_code[i] == "T":
        count += 1
        if(count >= count_end):
            count_end = count
    else:
        count = 0

print(count_end)

Submission status: Accepted

Solution code:
#ATCGのみを含む部分文字列の最長長さ

s=input()
list=[0,0,0,0,0,0,0,0,0,0]
j=0

for i in range(len(s)):
	if s[i]=="A" or s[i]=="T" or s[i]=="G" or s[i]=="C":
		list[j]+=1
	else:
		j+=1

print(max(list))

Submission status: Accepted

Solution code:
S = input()
ACGT = ['A', 'C', 'G', 'T']
length_S = len(S)
ans = 0

for i in range(length_S):
	length_substr = 0

	# i + 1文字目から始まる部分文字列の長さを算出
	for j in range(length_S - i):
		if S[i + j] in ACGT:
			length_substr += 1
		else:
			break

	ans = max(ans, length_substr)

print(ans)

Submission status: Accepted

Solution code:
import re


S=input()
s=re.split('[^AGCT]', S)

x=max(s,key=len)

print(len(x))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

cnt = 0
ans = 0

for ss in S:
    if ss in 'ACGT':
        cnt += 1
    else:
        cnt = 0
    ans = max(ans,cnt)
    
print(ans)

Submission status: Accepted

Solution code:
S = input()

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

count = 0
ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
s = input()
words = set()
words.add('')
words.add(s)
for i in range(len(s)):
    words.add(s[i])
    for j in range(i, len(s)+1):
        words.add(s[i:j])

matched = []
for w in words:
    n = 0
    for i in w:
        if i not in ['A', 'T', 'G', 'C']:
            n += 1
    if n == 0:
        matched.append(len(w))
print(max(matched))

Submission status: Accepted

Solution code:
S = input()

candidates = []

tmp = []

for char in S:
    if char in ["A", "T", "G", "C"]:
        tmp.append(char)
    else:
        candidates.append(tmp)
        tmp = []

if tmp != []:
    candidates.append(tmp)

sorted_candidates = sorted(candidates, reverse=True, key=lambda x: len(x))
print(len(sorted_candidates[0]))

Submission status: Accepted

Solution code:
S=input()
a=list(S)
for i in range(len(a)):
    if a[i] != 'A' and a[i] != 'G' and a[i] != 'C' and a[i] != 'T':
        a[i]='/'
b=''.join(a)
c=b.split('/')
ans=0
for j in range(len(c)):
    if ans<=len(c[j]):
        ans=len(c[j])
print(ans)

Submission status: Accepted

Solution code:
S = input()
_S = list(S)
for s in range(len(_S)):
    if _S[s] != ('A'):
        if _S[s] != ('C'):
            if _S[s] != ('G'):
                if _S[s] != ('T'):
                    _S[s] = ','
s_changed = "".join(_S)
_s = s_changed.split(',')
most = 0
for v in _s:
    if len(v) >= most:
        most = len(v)
print(most)

Submission status: Accepted

Solution code:
S = input()
atgc = 'ATGC'
c = 0
m = 0
for i in S:
    for j in atgc:
        if i == j:
            c += 1
            m = max(c, m)
            break
    else:
        c = 0
print(m)

Submission status: Accepted

Solution code:
import re
ll = list(map(len,re.sub('[^ACGT]',' ', input()).split()))
if len(ll) == 0:print(0)
else:print(max(ll))