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: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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


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


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


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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()

ans = 0
ans_lis = [0]

for i in range(0,len(S)-1):
    if S[i] in "ACGT":
        ans = ans + 1
    else:
        ans_lis.append(ans)
        ans = 0
        ans_lis.append(ans)

print(max(ans_lis))

Submission status: Wrong Answer

Solution code:
S = input()

ans = 0
ans_lis = [0]

for i in range(0,len(S)):
    if S[i] in "ACGT":
        ans = ans + 1
    else:
        ans_lis.append(ans)
        ans = 0
        ans_lis.append(ans)

print(max(ans_lis))

Submission status: Wrong Answer

Solution code:
S = input()

ans = 0
ans_lis = [0]

for i in range(len(S)):
    if S[i] in "ACGT":
        ans = ans + 1
    else:
        ans_lis.append(ans)
        ans = 0
        ans_lis.append(ans)

print(max(ans_lis))

Submission status: Wrong Answer

Solution code:
s=input()
L=len(s)
cnt=0
ans=0
dic=["A", "G", "C", "T"]

for i in range(L):
    if s[i] in dic:
        cnt+=1
    else:
        if cnt > ans:
            ans=cnt
        cnt=0

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()

l,r = 0,0
ma = 0
for l in range(len(s)):
    if(s[l] not in ['A','C','G','T']):continue
    for r in range(l,len(s)):
        if(s[r] not in ['A','C','G','T']):break
    ma = max(ma,max(1,len(s[l:r])))
print(ma)

Submission status: Wrong Answer

Solution code:
s = input()

l,r = 0,0
ma = 0
for l in range(len(s)):
    if(s[l] not in ['A','C','G','T']):continue
    for r in range(l,len(s)):
        if(s[r] not in ['A','C','G','T']):break
    ma = max(ma,len(s[l:r]))
print(ma)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()

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

ans = 0
temp = 0
for c in s:
    if c in acgt_list:
        temp += 1
        continue
    
    if temp > ans:
        ans = temp
    temp = 0
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l = ['A','T','C','G']
s = ''
tmp =''
st = input()
for i in st:
    if i in l:
        s+=i
        if i == st[len(st)-1] and len(s) > len(tmp):
            tmp = s
            s =''
    else:
        if len(s) > len(tmp):
            tmp = s
            s =''
print(len(tmp))

Submission status: Wrong Answer

Solution code:
l = ['A','T','C','G']
s = ''
tmp =''
for i in input():
    if i in l:
        s+=i
    else:
        if len(s) > len(tmp):
            tmp = s
            s =''
print(len(tmp))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S=str(input())
S=S.translate(str.maketrans({'A': 'a', 'T': 'a', 'C': 'a','G': 'a'}))

if "a" in S:
  l=len(S)
  for i in range(1,l+1):
    b=S.count(str("a"*i))
    if b == 0:
      print(i-1)
      break
else:
  print("0")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
n = len(S)
head, tail, max = 0, 0, 0
list = ['A', 'G', 'C', 'T']
while tail < n and head < n:
    if S[head] in list:
        head += 1
    else:
        if max < (head - tail):
            max = head - tail
        tail = head + 1
        head += 1
print(max)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
ans = []
cnt = 0

for s in input():

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

ans.append(cnt)

print(max(ans) )

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
lst = ["A", "C", "G", "T"]
flag = 0
cnt = 0
cnt_lst = []

for i in s:
    if flag:
        if i not in lst:
            cnt_lst.append(cnt)
            flag = 0
            cnt = 0
        else:
            cnt += 1
    else:
        if i in lst:
            flag = 1
            cnt += 1

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

Submission status: Wrong Answer

Solution code:
s = input()

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

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()

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

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()

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

print(mcnt)

Submission status: Wrong Answer

Solution code:
S = input()

cnt = 0
mcnt = 0
for i in S:
    print(i)
    if i == 'A' or i == 'C' or i == 'G' or i == 'T':
        cnt += 1
        mcnt = max(mcnt,cnt)

print(mcnt)

Submission status: Wrong Answer

Solution code:
S = input()

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

print(mcnt)

Submission status: Wrong Answer

Solution code:
S = input()
Max = 0
t = 0
for i in range(len(S)):
    if(S[i] == 'A')or(S[i]=='C')or(S[i]=='G')or(S[i]=='T'):
        k=i
        while k<len(S):
            if(S[k] not in ['A','C','G','T']):
                ans = k-i
                if(ans > Max):
                    Max = ans
                break
            k+=1
print(Max)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import re
s = input()
target = re.sub('[^ACGT]', '@', s)
print(target)
num_list = []
for t in target.split('@'):
  num_list.append(len(t))
print(max(num_list))

Submission status: Wrong Answer

Solution code:
s = input()
ans = 0

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

print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
s=input()
#for i in range(len(s),0,-1):
#    for j in range(0,len(s)-i+1):
#        #print(j,i+j)
#        s1=s[j:i+j:]
m=0
s1=""
for x in s:
    if x=='A' or x=='G' or x=='T' or x=='C':
        s1+=x
    else:
        m=max(m,len(s1))
        s1=""
print(m)

Submission status: Wrong Answer

Solution code:
s = input()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# B - ATCoder

S = input()

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

print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    # 入力
    s = input()

    sl = len(s)
    cnt = 0
    target = ["A", "T", "C", "G"]
    for i in range(sl):
        ss = s[i:]
        if not ss[0] in target:
            continue

        for j in range(1, sl - i):
            sss = ss[:-j]
            if not sss[-1] in target:
                continue

            if len(sss) > cnt:
                cnt = len(sss)

    print(cnt)


main()

Submission status: Wrong Answer

Solution code:
def atcoder(s):

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

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

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=input()
length=0
for i in range(len(s)):
    for j in range(i+1,len(s)):
        ans=s[i:j].replace('A','').replace('T','').replace('C','').replace('G','')
        if ans=='' and len(s[i:j])>=length:
            length=len(s[i:j])
print(length)

Submission status: Wrong Answer

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

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

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

print(M)

Submission status: Wrong Answer

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

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

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

print(M)

Submission status: Wrong Answer

Solution code:
s = input()

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()

cnt = 0
ans = 0
for i in s:
    if i == "A" or i == "C" or i == "G" or i == "T":
        cnt += 1
    elif i != "A" and i != "C" and i != "G" and i != "T":
        ans = max(ans,cnt)
        cnt = 0

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()

cnt = 0
ans = 0
for i in s:
    if i == "A" or i == "C" or i == "G" or i == "T":
        cnt += 1
    if i != "A" and i != "C" and i != "G" and i != "T":
        ans = max(ans,cnt)
        cnt = 0

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
i = 0
ans = 0
while i < len(s):
    if s[i] == "A" or s[i] == "T" or s[i] == "C" or s[i] == "G":
        for j in range(len(s) - i):
            if s[i + j] != "A" and s[i + j] != "T" and s[i + j] != "C" and s[i + j] != "G":
                break
        
        ans = max(ans, j)
    
    i += 1
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
S = input()
ans = 0
total = ''
for s in S:
    cut = 0
    for i in ['A', 'C', 'G', 'T']:
        if i == s:
            total = total + i
        else:
            cut += 1
    if cut == 4 and ans > 0:
        break
    ans += 1
if total:
    print(len(total))
else:
    print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()

n = len(s)

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

Submission status: Wrong Answer

Solution code:
import itertools

inputs = input()
acgt = "ACGT"

count = 0
for i in range(1, len(inputs)):
    flg = False
    combs = list(itertools.product(acgt, repeat=i))
    words = ["".join(c[j] for j in range(i)) for c in combs]

    for w in words:
        if w in inputs:
            flg = True
            break
    if flg == True:
        count = i
    else:
        break

print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
conti_cnt = 0
max_conti = 0
for i in s:
    if i in ['A', 'T', 'C', 'G']:
        conti_cnt += 1
    else:
        if max_conti < conti_cnt:
            max_conti = conti_cnt
            conti_cnt = 0
print(max_conti)

Submission status: Wrong Answer

Solution code:
s = input()
list_s = ["A","C","T","G"]
ans = []
count=0
for i in range(-1,len(s)-1):
    #List.append(s[i])
    #print(s[i])
    #print(s[i+1])
    if s[i] in list_s and s[i+1] in list_s:
        count+=1


if count>0:
    print(count+1)
else:
    print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()

length = 0
chain = -1
ans = 0
for a in S:
    if a == 'A' or a == 'C' or a == 'G' or a == 'T':
        length += 1
        chain = 1
    else:
        chain = -1
        if ans < length:
            ans = length
        length = 0

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=input()
lead=["b"]*len(s)
for i in range(len(s)):
  if s[i]=="A" or s[i]=="C" or s[i]=="G" or s[i]=="T":
    lead[i]="a"

count=0
l=[0]
for i in range(len(s)-1):
  if lead[i]=="a" and lead[i+1]=="a":
    count+=1
  elif lead[i]=="a" and lead[i+1]=="b":
    count+=1
    l.append(count)
    count=0
  elif i==len(s)-2:
    l.append(count)

print(max(l))

Submission status: Wrong Answer

Solution code:
s = input() #sys.stdin.readlineは最後が改行

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

print(ans)

Submission status: Wrong Answer

Solution code:
c,m=0,0
for i in input():
  if i in "AGCT":
    c+=1
  else:
    if c > m:
      m=c
    c=0
print(m)

Submission status: Wrong Answer

Solution code:
c,m=0,0
for i in input():
  if i in "AGCT":
    c+=1
  else:
    if c > m:
      m=c
      c=0
print(m)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
import sys

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

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()

l = len(S)

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

Submission status: Wrong Answer

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
    else:
        if max_cnt < cnt:
            max_cnt = cnt
        cnt = 0
print(max_cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = str(input())
count = 0
Answer = 0

for i in range(len(S)):
    if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
        count+=1
        for j in range(len(S)-1-i):
            if S[i+1+j] == "A" or S[i+1+j] == "C" or S[i+1+j] == "G" or S[i+1+j] == "T":
                count+=1
            else:
                break
        if Answer < count:
            Answer = count
            count = 0
        else:
            count = 0
            break

print(Answer)

Submission status: Wrong Answer

Solution code:
S = str(input())
count = 0
Answer = 0

for i in range(len(S)):
    if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
        count+=1
        for j in range(len(S)-1-i):
            if S[i+1+j] == "A" or S[i+1+j] == "C" or S[i+1+j] == "G" or S[i+1+j] == "T":
                count+=1
        if Answer < count:
            Answer = count
            count = 0
        else:
            count = 0
            break

print(Answer)

Submission status: Wrong Answer

Solution code:
S = str(input())
count = 0
Answer = 0

if len(S)==1:
    if S[0] == "A" or S[0] == "C" or S[0] == "G" or S[0] == "T":
        Answer = 1
        
else:
    for i in range(len(S)):
        if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
            count+=1
            for j in range(len(S)-1-i):
                if S[i+1+j] == "A" or S[i+1+j] == "C" or S[i+1+j] == "G" or S[i+1+j] == "T":
                    count+=1
                elif Answer < count:
                    Answer = count
                    count = 0
                    break
                else:
                    count = 0
                    break

print(Answer)

Submission status: Wrong Answer

Solution code:
S = str(input())
count = 0
Answer = 0

for i in range(len(S)):
    if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
        count+=1
        for j in range(len(S)-1-i):
            if S[i+1+j] == "A" or S[i+1+j] == "C" or S[i+1+j] == "G" or S[i+1+j] == "T":
                count+=1
            elif Answer < count:
                Answer = count
                count = 0
                break
            else:
                count = 0
                break

print(Answer)

Submission status: Wrong Answer

Solution code:
s = input()
items = ['A', 'T', 'G', 'C']
length = 0
maxLen = 0

for i in s:
    if i in items:
        length += 1
    else:
        if length > maxLen:
            maxLen = length

        length = 0

print(maxLen)

Submission status: Wrong Answer

Solution code:
S = input()

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

Submission status: Wrong Answer

Solution code:
S = input()
cut = 0
total = ''
for s in S:
    for i in ['A', 'C', 'G', 'T']:
        if i == s:
            total = total + i

if total:
    print(len(total))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
S = input()
cut = 0
total = ''
for s in S:
    for i in ['A', 'C', 'G', 'T']:
        if i == s:
            total = total + i

print(len(total))

Submission status: Wrong Answer

Solution code:

s = input()
ans = 0
for i in range(len(s)):
    count = 0
    for j in range(len(s)):
        if s[j] in "ACGT":
            count += 1
        else:
            break
    if count >= ans:
        ans = count
print(ans)

Submission status: Wrong Answer

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

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

print(max(possible_answers))

Submission status: Wrong Answer

Solution code:
S=input()
ACGT=['A','C','G','T']
ans=0
tmp=0
for s in S:
  if tmp==0:
    if s in ACGT: tmp+=1
  else:
    if s in ACGT:
      tmp+=1
      if tmp>ans: ans=tmp
    else:
      tmp=0
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
n = len(s)
dp = [0 for i in range(n+1)]
for i in range(n):
    res = 0
    if s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T':
        res = 1
    dp[i+1] = dp[i]+res
print(dp[n])

Submission status: Wrong Answer

Solution code:
S = input()

L = []
for i in range(len(S)):
    if(S[i] in 'ACGT'):
        count = 1
        for j in range(i + 1, len(S)):
            if (S[j] in 'ACGT'):
                count += 1
            else:
                L.append(count)
                break
            if (j + 1 == len(S)):
                L.append(count)
                break
    else:
        continue

if (len(L) == 0):
    print('0')
else:
    print(max(L))

Submission status: Wrong Answer

Solution code:
S = input()

L = []
for i in range(len(S)):
    if(S[i] in 'ACGT'):
        count = 1
    else:
        continue
    for j in range(i + 1, len(S)):
        if (S[j] in 'ACGT'):
            count += 1
        else:
            L.append(count)
            break

if (len(L) == 0):
    print('0')
else:
    print(max(L))

Submission status: Wrong Answer

Solution code:
S = input()
max = 0
ans = 0

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

print(max)

Submission status: Wrong Answer

Solution code:
S=str(input())
max_count = 0
count = 0
for i in range(len(S)):
  if S[i] == 'A' or S[i] == 'AT' or S[i] == 'G' or S[i] == 'C':
    count = count + 1
    if count > max_count:
      max_count = count
  else:
    count = 0
print(max_count)

Submission status: Wrong Answer

Solution code:
S=str(input())
max_count = 0
count = 0
for i in range(len(S)):
  if S[i] == 'A' or S[i] == 'AT' or S[i] == 'G' or S[i] == 'C':
    count = count + 1
    if count > max_count:
      max_count = count
  else:
    count = 0
print(count)

Submission status: Wrong Answer

Solution code:
s=input()
c=0
m=0
for e in s:
  if e in "ACGT":
    c+=1
  else:
    if c>=m:
      m=c
    c=0
if len(s)==c:
  m=len(s)
print(m)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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