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:
def main():
	# a,b,k = map(int,input().split())
	# n,k = map(int,input().split())
	s = list(str(input()))
	# a = list(map(int,input().split()))
	# rsp = list(str(input()))
	# l = [list(map(int, input().split())) for _ in range(n-1)]
	# s = list(s)
	avoid = 0
	ans = 0
	ans_rec = []
	for i in range(len(s)):
		if s[i] == "A" or s[i] == "T" or s[i] == "G" or s[i] == "C":
			# print("when i = {} is true".format(i))
			ans += 1
		else:
			ans_rec.append(ans)
			ans = 0
			
	print(ans_rec)

 
if __name__ == '__main__':
	main()

Submission status: Wrong Answer

Solution code:
S=input()
ans=0
cnt=0
for s in S:
    if s in S:
        if s in "ATCG":cnt+=1
        ans=max(ans,cnt)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=[i for i in input()]
l=[]
cnt=0
for i in range(len(s)):
  if s[i] in {"A","T","C","G"," "}:
    cnt+=1
    if i==len(s)-1:
      l.append(cnt)
  else:
    l.append(cnt)
    cnt=0

Submission status: Wrong Answer

Solution code:
S = str(input())
S_list = list(S)
S_switch = []

for i in range(len(S_list)):
    if S_list[i]=="T" or S_list[i]=="A" or S_list[i]=="G" or S_list[i]=="C":
        S_switch.append(1)
    else:
        S_switch.append(0)

count = 0
max_count = 0
for i in range(len(S_switch)):
    if S_switch[i] == 1:
        count = count + 1
    else:
        if count > max_count:
            max_count = count
        count = 0
print(max_count)

Submission status: Wrong Answer

Solution code:
s = input()
c = 0
for i in s:
    if i in "ACGT":
        c += 1
print(c)

Submission status: Wrong Answer

Solution code:
s = input()
c = 0
for i in s:
    if i in "ACGT":
        c += 1
    else:
        break
print(c)

Submission status: Wrong Answer

Solution code:
s = input()

st = 'ACGT'
ans = 0
cur = 0
for x in s:
  if x in st:
    cur += 1
  else:
    cur = 0
  ans = max(cur, ans)

Submission status: Wrong Answer

Solution code:
s = list(input())

max = 0
for i in range(len(s)):
    for j in reversed(range(len(s))):
        cnt = 0
        for k in range(0 + i, j):
            if s[k] == "A" or s[k] == "C" or s[k] == "G" or s[k] == "T":
                cnt += 1
        if max < cnt:
            max = cnt
print(max)

Submission status: Wrong Answer

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

S = input()

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()

list_ = [0]
length = 0

for i in range(len(S)):
    if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
        length += 1
    else:
        list_.append(length)
        length = 0
        
print(max(list_))

Submission status: Wrong Answer

Solution code:
S = input()
lst = ['A', 'G', 'C' ,'T']
cnt = 0
max_num = 0
for s in S:
    if s in lst:
        cnt += 1
    elif s not in lst and cnt > 0:
        if max_num > cnt:
            cnt = 0
        else:
            max_num = cnt
            cnt = 0
    else:
        pass
print(max_num)

Submission status: Wrong Answer

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

ans = [0]
count = 0

for i in s:
    if i in acgt:
        count += 1
    else:
        ans.append(count)
        count = 0

print(max(ans))

Submission status: Wrong Answer

Solution code:
S = input()
ltrs = "ACGT"
curr_max = 0
curr_len = 0
for ltr in S:
    if ltr in ltrs:
        curr_len += 1
    else:
        curr_max = max(curr_max, curr_len)
print(curr_max)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = []
count = 0
for i in range(len(s)):
    for j in s[i:]:
        if j in acgt:
            count += 1
        else:
            ans.append(count)
            count = 0
            break
        if j == s[-1]:
            ans.append(count)
            count = 0
            break
            
print(max(ans))

Submission status: Wrong Answer

Solution code:
S=list(input())
i=0
ans=0
for j in range(len(S)):
  if S[j]!="A" and S[j]!="T" and S[j]!="C" and S[j]!="G":
    ans=max(ans,len(S[i:j]))
    i=j+1
print(ans)

Submission status: Wrong Answer

Solution code:
a=input()
ans=[0]
for i in range(len(a)):
    for j in range(i,len(a)):
        s=a[i:j]
        if set(s)<=set('ACGT'):
            ans.append(len(s))
print(max(ans))

Submission status: Wrong Answer

Solution code:
a=input()
ans=[]
for i in range(len(a)):
    for j in range(i,len(a)):
        s=a[i:j]
        if set(s)<=set('ACGT'):
            ans.append(len(s))
print(max(ans))

Submission status: Wrong Answer

Solution code:
A = list(input())
S = ['A','C','G','T']
count = 0
a = []
a.append(count)
for i in A:
  if i in S:
    count += 1
    print(count)
    a.append(count)
  else:
    count = 0
print(max(a))

Submission status: Wrong Answer

Solution code:
A = list(input())
S = ['A','C','G','T']
count = 0
a = []
a.append(count)
for i in A:
  if i in S:
    count += 1
  else:
    a.append(count)
    count = 0
print(max(a))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = list(input())
l = ["A","T","C","G"]
ans=[0]
t = 0
for i in s:
    if  i in l:
        t += 1
    else:
        ans.append(t)
        t = 0

print(max(ans))

Submission status: Wrong Answer

Solution code:
import re
res = 0
tmp = 0
for s in input():
    if re.search('[ACGT]', s):
        tmp += 1
    else:
        res = max(res, tmp)
        tmp = 0
print(res)

Submission status: Wrong Answer

Solution code:
def p_b():
    s = input()
    s = s.replace("A", ".").replace("T", ".").replace("C", ".").replace("G", ".")
    ans = 0
    tmp = 0
    for e in s:
        if e != ".":
            ans = max(ans, tmp)
            tmp = 0
        else:
            tmp += 1
    print(ans)
p_b()

Submission status: Wrong Answer

Solution code:
S = input()
ans = 0

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

Submission status: Wrong Answer

Solution code:
S = input()

ans = 0
ACGT = ("A", "C", "G", "T")

count = 0
count_list = [0]
for s in S:
    if s not in ACGT:
        count_list.append(count)
        count = 0
        continue
    else:
        count += 1
print(max(count_list))

Submission status: Wrong Answer

Solution code:
S=input()

m_len=0
len=0

acgt={'A','C','G','T'}

for i in S:
    if i in acgt:
        len+=1
        #print(i,len)
    else:
        #print(i,len,m_len)
        if len>m_len:
            m_len=len
        len=0
        
len>m_len
m_len=len

print(m_len)

Submission status: Wrong Answer

Solution code:

S=input()

m_len=0
len=0

acgt={'A','C','G','T'}

for i in S:
    if i in acgt:
        len+=1
        #print(i,len)
    else:
        #print(i,len,m_len)
        if len>m_len:
            m_len=len
        len=0

print(m_len)

Submission status: Wrong Answer

Solution code:
S=input()

m_len=0
len=0

acgt={'A','C','G','T'}

for i in S:
    if i in acgt:
        len+=1
        #print(i)
    else:
        if len>m_len:
            m_len=len
        len=0

print(m_len)

Submission status: Wrong Answer

Solution code:
S=input()

m_len=0
len=0

acgt={'A','C','G','T'}

for i in S:
    if i in acgt:
        len+=1
        #print(i)
    else:
        if len>m_len:
            m_len=len
            len=0

print(m_len)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

S = list(input())
N = len(S)
tmp = ["A","G","C","T"]
ans = 0
for s in range(N):
    for t in range(N):
        flag = True
        for x in S[s:t]:
            if x  not in tmp:
                flag = False

        if flag:
            ans = max(ans,t-s)


print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

S = input()
print(S.count("A") + S.count("G") + S.count("C") + S.count("T"))

Submission status: Wrong Answer

Solution code:
a = list(input())

enki = set(["A", "C", "G", "T"])
cnt = 0
cntmax = 0
for i in a:
  if i in enki:
    cnt += 1
  else:
    if cntmax < cnt:
      cntmax = cnt
    cnt = 0

print(cntmax)

Submission status: Wrong Answer

Solution code:
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':
        cnt += 1
    else:
        ans = max(ans, cnt)
        cnt = 0
        

print(ans)

Submission status: Wrong Answer

Solution code:
ls_s = [_ for _ in input()]

cnt = 0
cmax = 0

for i in range(len(ls_s)):
    if (ls_s[i] == 'A') or (ls_s[i] == 'C') or (ls_s[i] =='G') or (ls_s[i] =='T'):
        cnt += 1
    elif cmax < cnt:
        cmax = cnt
        cnt = 0
    else:
        cnt = 0
print(cmax)

Submission status: Wrong Answer

Solution code:
ls_s = [_ for _ in input()]

cnt = 0
cmax = 0

for i in range(len(ls_s)):
    if (ls_s[i] == 'A') or (ls_s[i] == 'C') or (ls_s[i] =='G') or (ls_s[i] =='T'):
        cnt += 1
    elif cmax < cnt:
        cmax = cnt
        cnt = 0
print(cmax)

Submission status: Wrong Answer

Solution code:
ls_s = [_ for _ in input()]

cnt = 0
cmax = 0

for i in range(len(ls_s)):
    if (ls_s[i] == 'A') or (ls_s[i] == 'C') or (ls_s[i] =='G') or (ls_s[i] =='T'):
        cnt += 1
    else:
        if cmax < cnt:
            cmax = cnt
        cnt = 0
print(cmax)

Submission status: Wrong Answer

Solution code:
import itertools
# ACGT
S = list(input())

index_num =[]

ACGT = list("ACGT")

for i in ACGT:
    index_num.append([n for n, v in enumerate(S) if v == i])
aaa =sorted(list(itertools.chain.from_iterable(index_num)))

cnt =0
max_cnt =1

for i in range(len(aaa)-1):
    if aaa[i]+1 == aaa[i+1]:
        cnt +=1
    else:
        cnt =0
    max_cnt = max(max_cnt,cnt)

if len(aaa)==0:
    print(0)
elif max_cnt ==1:
    print(max_cnt)
else:
    print(max_cnt+1)

Submission status: Wrong Answer

Solution code:
import itertools
# ACGT
S = list(input())

index_num =[]

ACGT = list("ACGT")

for i in ACGT:
    index_num.append([n for n, v in enumerate(S) if v == i])
aaa =sorted(list(itertools.chain.from_iterable(index_num)))

cnt =0
max_cnt =1

for i in range(len(aaa)-1):
    if aaa[i]+1 == aaa[i+1]:
        cnt +=1
    else:
        cnt =0
    max_cnt = max(max_cnt,cnt)

if max_cnt ==1:
    print(0)
else:
    print(max_cnt+1)

Submission status: Wrong Answer

Solution code:
import itertools
# ACGT
S = list(input())

index_num =[]

ACGT = list("ACGT")

for i in ACGT:
    index_num.append([n for n, v in enumerate(S) if v == i])
aaa =sorted(list(itertools.chain.from_iterable(index_num)))

cnt =0
max_cnt =0

for i in range(len(aaa)-1):
    if aaa[i]+1 == aaa[i+1]:
        cnt +=1
    else:
        cnt =0
    max_cnt = max(max_cnt,cnt)

if max_cnt ==0:
    print(0)
else:
    print(max_cnt+1)

Submission status: Wrong Answer

Solution code:
import itertools
# ACGT
S = list(input())

index_num =[]

ACGT = list("ACGT")

for i in ACGT:
    index_num.append([n for n, v in enumerate(S) if v == i])


aaa =sorted(list(itertools.chain.from_iterable(index_num)))
#print(aaa)
cnt =0
max_cnt =0

for i in range(len(aaa)-1):
    if aaa[i]+1 == aaa[i+1]:
        cnt +=1
    else:
        cnt =0
    max_cnt = max(max_cnt,cnt)

if max_cnt ==0:
    print(0)
else:
    print(max_cnt+1)

Submission status: Wrong Answer

Solution code:
import itertools
# ACGT
S = list(input())

index_num =[]

ACGT = list("ACGT")

for i in ACGT:
    index_num.append([n for n, v in enumerate(S) if v == i])


aaa =sorted(list(itertools.chain.from_iterable(index_num)))
#print(aaa)
cnt =0
max_cnt =0

for i in range(len(aaa)-1):
    if aaa[i]+1 == aaa[i+1]:
        cnt +=1
    else:
        cnt =0
    max_cnt = max(max_cnt,cnt)
print(max_cnt+1)

Submission status: Wrong Answer

Solution code:
import itertools
# ACGT
S = list(input())

index_num =[]

ACGT = list("ACGT")

for i in ACGT:
    index_num.append([n for n, v in enumerate(S) if v == i])


aaa =sorted(list(itertools.chain.from_iterable(index_num)))
#print(aaa)
cnt =0
max_cnt =0

for i in range(len(aaa)-1):
    if aaa[i]+1 == aaa[i+1]:
        cnt +=1
    else:
        cnt =0
    max_cnt = max(max_cnt,cnt)
print(max_cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = list(input())
acgt = ['A', 'C', 'G', 'T']
ans = 0
for i in range(len(S)):
    for j in range(i):
        A = S[j:i+1]
        T = 1
        for a in A:
            if a not in acgt:
                T = 0
                break
        if T == 1:
            ans = max(ans,len(A))
print(ans)

Submission status: Wrong Answer

Solution code:
s = list(input())
gene = ["A","T","G","C"]
ans = [0]
count = 0
for i in range(len(s)):
  if s[i] in gene:
    count += 1
  elif count > 0:
    ans.append(count)
    count = 0
print(max(ans))

Submission status: Wrong Answer

Solution code:
S = input()

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

print(res)

Submission status: Wrong Answer

Solution code:
max_num = 0
num = 0
for c in input():
    if c in {"A", "C", "G", "T"}:
        num += 1
    else:
        max_num = max(max_num, num)
max_num = max(max_num, num)
print(max_num)

Submission status: Wrong Answer

Solution code:
max_num = 0
num = 0
for c in input():
    if c in {"A", "C", "G", "T"}:
        num += 1
    else:
        max_num = max(max_num, num)
print(max_num)

Submission status: Wrong Answer

Solution code:
S = list(input())

s = ""
mem = ""
for i in range(len(S)):
    s_ = S[i]
    if(s_=="A" or s_=="C" or s_=="G" or s_=="T"):
        mem += s_
    else:
        if(len(s)<=len(mem)):
            s = mem
            
        mem = ""
        
print(len(s))

Submission status: Wrong Answer

Solution code:
s = input()
b = 'ACGT'
a = t = 0

for c in s:
    if c in b:
        t += 1
    else:
        a = max(a, t)
        t = 0

print(a)

Submission status: Wrong Answer

Solution code:
# ABC 122: B – ATCoder
s = input()
acgt = 'ACGT'

length = 0
max_length = 0

for i in range(len(s)):
    if s[i] in acgt:
        for j in range(len(s) - i):
            if s[i + j] in acgt:
                length += 1
            else:
                max_length = max(max_length, length)
                length = 0
                break

print(max_length)

Submission status: Wrong Answer

Solution code:
# ABC 122: B – ATCoder
s = input()
acgt = 'ACGT'

length = 0
max_length = 0

for i in range(len(s)):
    if s[i] in acgt:
        length += 1
        for j in range(1, len(s) - i):
            if s[i + j] in acgt:
                length += 1
            else:
                max_length = max(max_length, length)
                length = 0
                break

print(max_length)

Submission status: Wrong Answer

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

tmp = 0
cnt = 0
for i in s:
    if i in (at):
        tmp+=1
    else:
        if cnt < tmp:
            cnt = tmp
        tmp = 0
            
print(cnt)

Submission status: Wrong Answer

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

tmp = 0
cnt = 0
for i in s:
    if i in (at):
        tmp+=1
    else:
        if cnt < tmp:
            cnt = tmp
            
print(cnt)

Submission status: Wrong Answer

Solution code:
# 2019-11-12 22:21:08(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

def main():
    s = sys.stdin.readline().rstrip()
    
    permitted = 'ACGT'
    continuous_count = []
    count = 0

    for i in range(len(s)):
        char = s[i]
        if char in permitted:
            count += 1
        else:
            continuous_count.append(count)
            count = 0
    
    if not continuous_count:
        print(len(s))
    else:
        print(max(continuous_count))



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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:
    if ans<count:
      ans=count
    count=0
print(ans)

Submission status: Wrong Answer

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

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:
    if ans<count:
      ans=count
      count=0
print(ans)

Submission status: Wrong Answer

Solution code:
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

S=one_str()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

tans = ''
ans = ''

for i in range(len(S)):
  if S[i] in ACGT:
    tans = tans + S[i]
  else:
    if len(ans) < len(tans):
      ans = tans
    tans = ''

print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
S = input()
n = len(S)
l = np.zeros(n, dtype=int)
DNA = ['A', 'G', 'C', 'T']
for i in range(n):
  if(S[i] in DNA):
    for j in range(i+1, n):
      if(S[j] not in DNA):
        l[i] = j-i
        i = j+1
        break;
print(max(l))

Submission status: Wrong Answer

Solution code:
N=input()

print(N.count("A")+N.count("T")+N.count("G")+N.count("C"))

Submission status: Wrong Answer

Solution code:
S = input()

max_length = 0
for i in range(len(S)):
  if S[i] in "ACGT":
    if i == len(S) - 1:
      length = 1
    else:
      for j in range(i+1, len(S)):
        length = j - i + 1
        if S[j] in "ACGT":
          continue
        else:
          break

    if length > max_length:
      max_length = length

print(max_length)

Submission status: Wrong Answer

Solution code:
S = input()

length = 0
for i in range(len(S)):
  if S[i] in "ACGT":
    j = i+1
    for j in range(i+1, len(S)):
      if S[j] in "ACGT":
        continue
      else:
        break
    if j - i > length:
      length = j - i

print(length)

Submission status: Wrong Answer

Solution code:
S = input()

length = 0
for i in range(len(S)):
  if S[i] in "ACGT":
    j = 0
    for j in range(i+1, len(S)):
      if S[j] in "ACGT":
        continue
      else:
        break
    if j - i > length:
      length = j - i

print(length)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
ans = 0
cnt = 0

for e in s:
    if e in "ACGT":
        cnt += 1
    else:
        if cnt > ans:
            ans = cnt
        cnt = 0

print(ans)

Submission status: Wrong Answer

Solution code:
T = input()+"Z"  #T=ATCODERZ
x=["A","C","G","T"]
count=0
stock=[]

for i in range(len(T)):
  if T[i] in x:
    count += 1
  else:
    stock.append(count)
    count = 0

print(stock[-1])

Submission status: Wrong Answer

Solution code:
T = input()+"Z"  #T=ATCODERZ
x=["A","C","G","T"]
count=0
stock=[]

for i in range(len(T)):
  if T[i] in x:
    count += 1
    print(T[i])
  else:
    stock.append(count)
    count = 0

print(stock[-1])

Submission status: Wrong Answer

Solution code:
s = input()

ans = 0
tmp = 0

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

Submission status: Wrong Answer

Solution code:
s=input()
r=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:
    r=max(r,count)
    count=0
print(r)

Submission status: Wrong Answer

Solution code:
list1 = list(input())
maxlen = 0
count = 0
for i in range(len(list1)):
    if list1[i] == "A" or \
    list1[i] == "T" or \
    list1[i] == "C" or \
    list1[i] == "G":
        count += 1
    else:
        maxlen = max(maxlen,count)
        count = 0
print(maxlen)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
ans = 0
for i in range(len(S)):
	for j in range(i + 1, len(S)):
		s = S[i:j]
		ok = True
		for k in range(len(s)):
			if s[k] not in {'A', 'C', 'G', 'T'}: ok = False
		if ok: ans = max(ans, j - i)
print(ans)

Submission status: Wrong Answer

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

def main():
    S = input().strip()
    ma = 0
    ACGT = ['A', 'C', 'G', 'T']
    count = 0
    for s in S:
        if s in ACGT:
            count += 1
        else:
            ma = max(ma, count)
            count = 0

    print(ma)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

cnt = 0
mx = 0
for i in range(len(s)):
	if s[i] in lst:
		cnt += 1
	else:
		if mx < cnt:
			mx = cnt
		cnt = 0
print(mx)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

counter = 0
ans_L = []
for val in s:
    if val in L:
        counter += 1
    else:
        ans_L.append(counter)
        counter = 0
ans_L.append(0)

print(max(ans_L))

Submission status: Wrong Answer

Solution code:
S = input()

partial = ""

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

conlist = []

con = 0

for i in range(0,len(S)):
	if S[i] in conditions:
		for j in range(0,i+1):
			print(S[j])
			if S[j] in conditions:
				con +=1
			if (S[j] not in conditions) or j == i:
				conlist.append(con)
				con = 0
				

if len(conlist) > 0:
	print(max(conlist))
else:print(0)

Submission status: Wrong Answer

Solution code:
s=str(input())
ans=1
counter=0
for i in s:
	if "A" == i: counter+=1
	elif "C" == i: counter+=1
	elif "G" == i: counter+=1
	elif "T" == i: counter+=1
	else: counter=0
	ans=max(ans,counter)
print(ans)

Submission status: Wrong Answer

Solution code:
s=str(input())

lens=len(s)
ans=0
list=[]

for i in range(lens):
	if (s[i]=='A')|(s[i]=='T')|(s[i]=='C')|(s[i]=='G'):
		ans=ans+1
	else:
		list.append(ans)
		ans=0
list.append(ans)

print(list)
print(max(list))

Submission status: Wrong Answer

Solution code:
S = input()
acgt = ["A", "C", "G", "T"]
count = 0
ans = 0

for i in S:
    if i in acgt:
        count += 1

    elif count > ans:
        ans = count

    else:
        count = 0

print(ans)

Submission status: Wrong Answer

Solution code:
s = list(input())
cnt,tmp = 0,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:
        cnt = max(cnt,tmp)
        tmp = 0
print(cnt)

Submission status: Wrong Answer

Solution code:
S = input()
acgt = ["A","C","G","T"]
for i in range(len(S)):
    tmp = 0
    if S[i] in acgt:
        tmp += 1
        for j in range(i+1,len(S)):
            if S[j] in acgt:
                tmp += 1
                continue
            else:
                print(S[i:j])
                tmp =max(tmp, j-i)
                break
print(tmp)

Submission status: Wrong Answer

Solution code:
S = input()
tmp = 0
acgt = ["A","C","G","T"]
for i in range(len(S)):
    if S[i] in acgt:
        for j in range(i+1,len(S)):
            if S[j] in acgt:
                continue
            else:
                tmp =max(tmp, j-i)
                break
print(tmp)

Submission status: Wrong Answer

Solution code:
S = input()
tmp = 0
acgt = ["A","C","G","T"]
for i in range(len(S)):
    if S[i] in acgt:
        for j in range(i+1,len(S)):
            if S[j] in acgt:
                continue
            else:
                print(tmp,j-i)
                tmp =max(tmp, j-i)
                break
print(tmp)

Submission status: Wrong Answer

Solution code:
S = input()
tmp = 0
acgt = ["A","C","G","T"]
for i in range(len(S)):
    if S[i] in acgt:
        for j in range(i+1,len(S)):
            print(S[i:j])
            if S[j] in acgt:
                continue
            else:
                tmp =max(tmp, j-i)
                break
print(tmp)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
print(S.count('A')+S.count('T')+S.count('G')+S.count('T'))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = list(input())

count = 0
max_count = 0

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


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

if count > max_count:
    max_count = count

print(max_count)

Submission status: Wrong Answer

Solution code:
S = list(input())

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

if count > max_count:
    max_count = count

print(max_count)

Submission status: Wrong Answer

Solution code:
S = list(input())

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

if count > max_count:
    max_count = count

print(max_count)