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().strip()
ans = 0
l = 0
for _s in s:
  if s in ['A', 'C', 'G', 'T']:
    l += 1
  else:
    ans = max(ans, l)
print(max(ans, l))

Submission status: Wrong Answer

Solution code:
S = input()
rules = set(("A", "C", "G", "T"))

long = 0
result = -1
for s in S:
    if s in rules:
        long += 1
    else:
        result = max(result, long)
        long = 0
print(result)

Submission status: Wrong Answer

Solution code:
s = list(input())
list = {"A", "T", "G", "C"}
tmp = 0
count = 0
for i in s:
    count += 1
    if i not in list:
        if count -1 > tmp:
            tmp = count-1
        count = 0
if(count == len(s)):
    print(len(s))
else:
    print(tmp)

Submission status: Wrong Answer

Solution code:
S = input()
ans = ''
for i in S:
    if i==S[0] and i not in 'ACGT':
        continue
    if i in 'ACGT':
        ans += i
    if i not in 'ACGT':
        print(len(ans))
        exit()

print(len(ans))

Submission status: Wrong Answer

Solution code:
base_chars = set("ACGT")

max_len = 0
tmp_len = 0
for c in input().strip():
  if c in base_chars:
    tmp_len += 1
  else:
    max_len = max(max_len, tmp_len)
    tmp_len = 0
print(max_len)

Submission status: Wrong Answer

Solution code:
S = input()
s = len(S)
L = []
temp = 0
for i in range(s):
    if S[i]=='A' or S[i]=='T' or S[i]=='G' or S[i]=='C':
        if temp ==0:
            temp=1
        else:
            temp*=10
            L.append(temp)
    else:
        temp = 0
L.append(-1)        
if L[-1]==-1:
    P=0
else:
    P = len(str(max(L)))
print(P)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
S = str(input())

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

count = 0
count_list = []
count_list.append(0)
list_S = list(S)

for i in range(0, len(list_S)):
  if list_S[i] in acgt_list:
    for j in range(i, len(list_S)):
      if list_S[j] in acgt_list:
        count += 1
      else:
        count_list.append(count)
        count = 0
        break
  else:
    continue
print(max(count_list))

Submission status: Wrong Answer

Solution code:
s = input()
def check(a):
    ALLOWED = "ACGT"
    for c in a:
        if not c in ALLOWED:
            return False
    return True

ans = 0
for i in range(len(s) - 1):
    for j in range(1, len(s) - i + 1):
        tmp = s[i: i + j]
        if check(tmp):
            ans = max(ans, len(tmp))
print(ans)

Submission status: Wrong Answer

Solution code:
base_chars = set("ACGT")

max_len = 0
tmp_len = 0
for c in input().strip():
  if c in base_chars:
    tmp_len += 1
  else:
    max_len = max(max_len, tmp_len)
print(max_len)

Submission status: Wrong Answer

Solution code:
s = list(input())
list = {"A", "T", "G", "C"}
tmp = 0
count = 0
for i in s:
    count += 1
    if i not in list:
        if count -1 > tmp:
            tmp = count-1
        count = 0
if(tmp == 0):
    print(len(s))
else:
    print(tmp)

Submission status: Wrong Answer

Solution code:
S = str(input())

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

count = 0
count_list = []
count_list.append(0)
list_S = list(S)

for i in range(0, len(list_S)):
  if list_S[i] in acgt_list:
    for j in range(i, len(list_S)):
      if list_S[j] in acgt_list:
        count += 1
      else:
        count_list.append(count)
        count = 0
        break
  else:
    continue
print(count_list)

Submission status: Wrong Answer

Solution code:
S = input()
s = len(S)
L = []
temp = 0
for i in range(s):
    if S[i]=='A' or S[i]=='T' or S[i]=='G' or S[i]=='C':
        if temp ==0:
            temp=1
        else:
            temp*=10
            L.append(temp)
    else:
        temp = 0
L.append(0)        
if L[-1]==0:
    P=0
else:
    P = len(str(max(L)))
print(P)

Submission status: Wrong Answer

Solution code:
count = 0;
maxnum=0;
s = input();

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

print(maxnum);

Submission status: Wrong Answer

Solution code:
s = input()
def check(a):
    ALLOWED = "ACGT"
    for c in a:
        if not c in ALLOWED:
            return False
    return True

ans = 0
for i in range(len(s) - 1):
    for j in range(1, len(s) - i + 1):
        tmp = s[i: i + j]
        print(tmp)
        if check(tmp):
            ans = max(ans, len(tmp))
print(ans)

Submission status: Wrong Answer

Solution code:
cnt = 0
list = []
for i in input():
    if i in ['A','C','G','T']:
        cnt += 1
    else:
        if cnt >= 1:
            list.append(cnt)
        cnt = 0

print(max(list) if list else 0)

Submission status: Wrong Answer

Solution code:
s=-1
S=raw_input()
for i in range(len(S)):
  if S[i]in "ATCG":
    if s==-1:
      s=i
    e=i
if s==-1:
  print 0
else:
  print e-s+1

Submission status: Wrong Answer

Solution code:
def get_char_ngram(n,s):
    char_gram = [''.join(s[i:i+n]) for i in range(len(s)-n+1)]
    return char_gram

S = input()

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

res = 0

for i in range(len(S)):
    for j in range(i,len(S)):
        for k in range(len(S[i:-j])):
            c = get_char_ngram(k,S[i:-j])
            flag = True
            for l in c:
                for m in l:
                    if m not in st:
                        flag = False
                if flag:
                    res = max(res,len(l))

print(res)

Submission status: Wrong Answer

Solution code:
def checkACGT(s):
    for i in range(len(s)):
        if s[i] == "A" or s[i] == "G" or s[i] == "C" or s[i] == "T":
            continue
        else:
            return False
    return True

s=input()
n = len(s)
check = []
check.append(s)
while True:
    if checkACGT(check[0]):
        print(len(check[0]))
        break
    else:
        if len(check[0]) == 1:
            print(0)
            break
        check.append(check[0][1:])
        check.append(check[0][:len(check[0])-1])
        check.pop(0)
    print(check)

Submission status: Wrong Answer

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


def not_acgt(s):
    for c in s:
        if c not in ACGT:
            return False

    return True


def main():
    S = input()

    results = []
    # all_results = []
    for i in range(len(S)):
        for j in range(len(S)):
            if not_acgt(S[i:j]):
                results.append(S[i:j+1])
            # all_results.append(S[i:j+1])

    print(max([len(s) for s in results]))


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
input = input()
acgt = 'ACGT'

cnt = 0
max_cnt = 0
for s in input:
    if s in acgt:
        cnt += 1
    elif cnt > max_cnt:
        max_cnt = cnt
        cnt = 0
    else:
        cnt = 0

print(max_cnt)

Submission status: Wrong Answer

Solution code:
S = input()
list_atgc = ["A", "C", "G", "T"]
demand_list = []
for i in range(len(S)):
    if S[i] in list_atgc:
        for j in range(i, len(S)-i):
            if S[j] in list_atgc:
                demand_list.append(S[i:j+1])
            else:
                break
if demand_list:
    print(len(max(demand_list, key=len)))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
S=input()
slist=[]
for i in range(len(S)):
    for j in range(i+1, len(S)+1):
        slist.append(S[i:j])
ma=0
for s in slist:
    flag = True
    for w in s:
        if w not in ['A','C','G','T']:
            flag = False
    if flag:
        print(s)
        ma = max(ma, len(s))
print(ma)

Submission status: Wrong Answer

Solution code:
S = input()
list_atgc = ["A", "C", "G", "T"]
demand_list = []
for i in range(len(S)):
    if S[i] in list_atgc:
        for j in range(i, len(S)-i):
            if S[j] in list_atgc:
                demand_list.append(S[i:j+1])
            else:
                break
print(demand_list)
if demand_list:
    print(len(max(demand_list, key=len)))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
a = list(input())
ans =[0]
for i in range(len(a)):
    k = 0
    if a[i] == "A"or a[i] == "G"or a[i] == "C"or a[i] == "T":
     for j in range(i,len(a)):
        if a[j] == "A"or a[j] == "G"or a[j] == "C"or a[j] == "T":
            k += 1
        else:
            ans.append(k)
            i = j
            break



print(max(ans))

Submission status: Wrong Answer

Solution code:
s = input()

def atgc(l, r):
    global s
    for i in range(l, r):
        if s[i] != "A" and s[i] != "T" and s[i] != "G" and s[i] != "C":
            return False
    return True

t_max = 0

for i in range(0, len(s)):
    for j in range(i + 1, len(s)):
        if atgc(i, j) and t_max < j - i:
            t_max = j - i
            
print(t_max)

Submission status: Wrong Answer

Solution code:
s = input()
sl = len(s)
dic = {"A":1,"C":1,"G":1,"T":1}
cntmax = 0
for i in range(sl):
    cnt=0    
    for j in range(i,sl):
        try :
            # print(str(cnt) +" "+ s[j])
            cnt += dic[s[j]]
        except KeyError:
            if cntmax < cnt:
                # print(str(i)+" "+str(j)+" "+str(cntmax)+" "+str(cnt))
                cntmax = cnt
    if cntmax < cnt:
        cntmax = cnt
print(cntmax)

Submission status: Wrong Answer

Solution code:
s = list(input())

acgt = ['']
while len(s) != 0:
	if s[0] == 'A' or s[0] == 'C' or s[0] == 'G' or s[0] == 'T':
		acgt[-1] += s.pop(0)
	else:
		s.pop(0)
		acgt.append('')
	print(acgt)

print(max([len(e) for e in acgt]))

Submission status: Wrong Answer

Solution code:
a = input()
sum = 0
max = 0
for i in a:
    if i is "A":
        sum += 1
    elif i is "T":
        sum += 1
    elif i is "C":
        sum += 1
    elif i is "G":
        sum += 1
    else:
        if sum > max:
            max = sum
        sum = 0

print(max)

Submission status: Wrong Answer

Solution code:
input = input()
acgt = 'ACGT'

cnt = 0
max_cnt = 0
for s in input:
    if s in acgt:
        cnt += 1
    elif cnt > max_cnt:
        max_cnt = cnt
        cnt = 0

print(max_cnt)

Submission status: Wrong Answer

Solution code:
S=input()
slist=[S]
for i in range(len(S)):
    for j in range(i+1, len(S)):
        slist.append(S[i:j])
ma=0
for s in slist:
    flag = True
    for w in s:
        if w not in ['A','C','G','T']:
            flag = False
    if flag:
        print(s)
        ma = max(ma, len(s))
print(ma)

Submission status: Wrong Answer

Solution code:
s = list(input())

acgt = ['']
while len(s) != 0:
	if s[0] == 'A' or s[0] == 'C' or s[0] == 'G' or s[0] == 'T':
		acgt[0] += s.pop(0)
	else:
		s.pop(0)
		acgt.append('')

print(max([len(e) for e in acgt]))

Submission status: Wrong Answer

Solution code:
S = input()

not_agct = "BDEFHIJKLMNOPQRSUVWXYZ"

head = 0
tail = 0
length = len(S)

candi = []

for head in range(length):
    for tail in range(length - head):
        candi.append(S[head:tail+1])        

candi_sort = sorted(candi)

ans = 0
for txt in candi_sort:
    for judge in txt:
        if judge in not_agct:
            break
    else:
        if ans < len(txt):
            ans = len(txt) 

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
start = 0
max = 0
count = 0
for i in range(len(S)):
    print(count,max)
    if(S[i] != "A")&(S[i] != "T")&(S[i] != "G")&(S[i] != "C"):
        if max < count:
            max = count
        count = 0
    else:
        count = count + 1
if ((S[i] == "A")|(S[i] == "T")|(S[i] == "G")|(S[i] == "C"))&(max < count):
    max = count
print(max)

Submission status: Wrong Answer

Solution code:
s = list(input())
list = {"A", "T", "G", "C"}
tmp = 0
count = 0
for i in s:
    count += 1
    if i not in list:
        if count -1 > tmp:
            tmp = count-1
        count = 0
print(tmp)

Submission status: Wrong Answer

Solution code:
S = input()
list_atgc = ["A", "C", "G", "T"]
demand_list = []
for i in range(len(S)):
    if S[i] in list_atgc:
        for j in range(i, len(S)-i):
            if S[j] in list_atgc:
                demand_list.append(S[i:j+1])
if demand_list:
    print(len(max(demand_list, key=len)))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
s = list(input())

li = []
result = []
pre = 0
n=0

for i in s:
	n=n+1
	if pre == 0 and (i == "A" or i == "C" or i == "G" or i == "T"):
		li.append(i)
		pre=1
	elif pre == 1 and (i == "A" or i == "C" or i == "G" or i == "T"):
		li.append(i)
		if n == len(s):
			if len(li)>len(result):
				result = li
	elif pre==1:
		if len(li)>len(result):
			result = li
		li=[]
		pre=0

print(len(result))

Submission status: Wrong Answer

Solution code:
input = input()
acgt = 'ACGT'

cnt = 0
max_cnt = 0
for s in input:
    if s in acgt:
        cnt += 1
    elif cnt > max_cnt:
        max_cnt = cnt

print(max_cnt)

Submission status: Wrong Answer

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

for c in S:
  if c == 'A' or c == 'C' or c == 'G' or c == 'T':
    count+=1
  else:
    list.append(count)
    count = 0

if not list:
    print('0')
else:
    print(max(list))

Submission status: Wrong Answer

Solution code:
from sys import stdin
s = input()
a = []
a.append(s.find('A'))
a.append(s.find('T'))
a.append(s.find('G'))
a.append(s.find('C'))
for i in range(len(a)):
    if a[i] == -1:
        a[i] = 100
start = min(a)
#print(a)
pos = 0
sol = 0
for i in range(start, len(s)):
    #print(start)
    if s[i] != 'A' and s[i]!='T' and s[i]!='G' and s[i]!='C':
        pos = i
        if pos - start > sol:
            sol = pos - start
        #start = i+1
        a.clear()
        a.append(s.find('A', i))
        a.append(s.find('T', i))
        a.append(s.find('G', i))
        a.append(s.find('C', i))
        for i in range(len(a)):
            if a[i] == -1:
                a[i] = 100
        start = min(a)
print(sol)

Submission status: Wrong Answer

Solution code:
#B問題
S=str(input())
Slist=list(S)
Slen=len(Slist)
MAX=0
for i in range(Slen):
    for j in range(Slen-i-1):
        J=j+i+1
        karis=Slist[i:J+1]
        flag = 0
        print(karis)
        for x in karis:
            if x == "A" or x == "T" or x == "C" or x == "G":
                pass
            else:
                flag = 1
                break
        if flag == 0:
            MAX=max(MAX,len(karis))
if MAX == 0:
    if "A" in S or "T" in S or "G" in S or "C" in S:
        print(1)
    else:
        print(0)
else:
    print(MAX)

Submission status: Wrong Answer

Solution code:
def AGCT(x):
    if x=='A':
        return True
    elif x=='G':
         return True
    elif x =='C':
        return True 
    elif x=='T':
        return True
    else:
        return False

S = list(input())
Ans = [0]
flag = 0
i_new =0
ans = 1
for i in range(len(S)):
    ans = 1
    if AGCT(S[i])==True:
        i_new = i
        while flag ==0:
            i_new += 1
            if i_new >len(S)-i-1:
                flag = 1
                Ans.append(ans)
            elif AGCT(S[i_new])==False:
                flag = 1
                Ans.append(ans)
            else:ans += 1

print(max(Ans))

Submission status: Wrong Answer

Solution code:
def checkACGT(s):
    for i in range(len(s)):
        if s[i] == "A" or s[i] == "G" or s[i] == "C" or s[i] == "T":
            continue
        else:
            return False
    return True
  
s=input()
n = len(s)
check = []
check.append(s)
while True:
    if checkACGT(check[0]):
        print(len(check[0]))
        break
    else:
        if len(check[0]) == 1:
            print(0)
            break
        check.append(check[0][1:])
        check.append(check[0][:len(check[0])-2])
        check.pop(0)

Submission status: Wrong Answer

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


def not_acgt(s):
    for c in s:
        if c not in ACGT:
            return False

    return True


def main():
    S = input()

    results = []
    for i in range(len(S)):
        for j in range(len(S)):
            if not_acgt(S[i:j]):
                results.append(S[i:j])

    print(max([len(s) for s in results]))


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
S = input()
acgt = ["A","C","G","T"]
S_tf = [any([sss == aaa for aaa in acgt]) for sss in S]
maxlen = 0
curlen = 0
for i in S_tf:
    if i:
        curlen += 1
    else:
        if maxlen < curlen:
            maxlen = curlen
        curlen = 0
print(maxlen)

Submission status: Wrong Answer

Solution code:
a = list(input())
ans =[0]
for i in range(len(a)):
    k = 0
    if a[i] == "A"or a[i] == "G"or a[i] == "C"or a[i] == "T":
     for j in range(i,len(a)):
        if a[j] == "A"or a[j] == "G"or a[j] == "C"or a[j] == "T":
            k += 1
        else:
            ans.append(k)
            break




print(max(ans))

Submission status: Wrong Answer

Solution code:
import re

S = input()
H = re.findall("([ACGT]+)", S)
if H:
	print(len(max(H)))
else:
	print(0)

Submission status: Wrong Answer

Solution code:
S = input()

max_ss = 0
current_size = 0

for i in range(0,len(S)-1):
  
  if S[i] in ['A','G','C','T']:
    current_size += 1
    
  else:
    max_ss=max(max_ss,current_size)
    current_size=0

max_ss=max(max_ss,current_size)

print(max_ss)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 24 17:18:46 2019
ABC122B
@author: maezawa
"""

s = input()
n = len(s)
cnt = 0
atcgset = set(['A','T','C','G'])
for i in range(n):
    for j in range(i,n):
        subs = s[i:j+1]
        #print(s[i:j+1])
        sset = set(s[i:j+1])
        if atcgset > sset:
            #print(s[i:j])
            if len(subs) >= cnt:
                cnt = len(subs)
print(cnt)

Submission status: Wrong Answer

Solution code:
s = input()

l = ["A","C","G","T"]
res = 0

for i in range(len(s)):
    #print(i)
    tmp = 0
    print(s[i:])
    for j in s[i:]:
        if j in l:
            tmp += 1
        else:
            res = max(res,tmp)
            #print(res)
            break
    else:
        res = max(res,tmp)
else:
    print(res)

Submission status: Wrong Answer

Solution code:
def tasu(j):
    global bubun
    
    if j + 1 >= len(string):
        return
    elif string[j] == "A" or string[j] == "C" or string[j] == "G" or string[j] == "T":
        bubun += string[j + 1]
        tasu(j + 1)

string = input()

lst = [""]

for i in range(len(string)):
    if string[i] == "A" or string[i] == "C" or string[i] == "G" or string[i] == "T":
        bubun = string[i]
        tasu(i)
        lst.append(bubun)
    
print(len(max(lst)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
acgt = ["A", "C", "G", "T"]
s = input()
cnt = 0
cnt_max = 0
for c in list(s):
  if c in acgt:
    cnt += 1
  else:
    if cnt > cnt_max:
      cnt_max = cnt
    cnt = 0
print(cnt_max)

Submission status: Wrong Answer

Solution code:
S = input()

max_ss = 0
current_size = 0

for i in range(0,len(S)-1):
  
  if S[i] in ['A','G','C','T']:
    current_size += 1
    
  else:
    max_ss=max(max_ss,current_size)

max_ss=max(max_ss,current_size)

print(max_ss)

Submission status: Wrong Answer

Solution code:
piece = ["A", "T", "C", "G"]
string = input()
length = -1
count = 0

for i in range(len(string)):
  count = 0
  j = i
  for key in range(j, len(string)):
    if string[key] in piece:
      count += 1;
    else:
      if count > length:
        length = count
      break

print(length)

Submission status: Wrong Answer

Solution code:
Ss=[i for i in input()]
anss = []
counter = 0
for i in range(len(Ss)):
    if Ss[i]!="A" and Ss[i]!="C" and Ss[i]!="G" and Ss[i]!="T":
        anss.append(counter)
        counter=0
    else:
        counter+=1
if len(anss)!=0:
    print(max(anss))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
l = ["A","T","C","G"]
S = input()
tmp = ""
ans = 0
for s in S:
  if not s in l:
    ans = max(ans,len(tmp))
    tmp = ""
  else:
    tmp += s
tmp = ""
for s in S[::-1]:
  if not s in l:
    ans = max(ans,len(tmp))
    tmp = ""
  else:
    tmp += s
print(ans)

Submission status: Wrong Answer

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

import sys

def parse_input(lines_as_string = None):


    lines = []
    if lines_as_string is None:
        lines.append(input())
    else:
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    tokens = lines[0].split(" ")
    s = tokens[0]

    return (s,)


def solve(s):
    
    count = 0
    m = 0
    for i, c in enumerate(s):
        if c in "ACGT":
            count = count + 1
        else:
            if count > m:
                m = count
            count = 0

    return m

def main():
    # 出力

    print("%s" % solve(*parse_input()))

if __name__ == '__main__':

    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
def main():
    s = input()

    got = ""

    current = ""
    for r in s:
        if r in ['A', 'C', 'G', 'T']:
            current += r
        else:
            if len(current) >= len(got):
                got = current
            current = ""

    print(len(got))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
s = input()
n = len(s)
i = 0
a = 0
while i<n:
    c,j = 0,i
    while j < n:
        t = (s[j:j+1])
        if t == "A" or t == "C" or t == "G" or t == "T":
            j += 1
            c += 1
        else:
            if c > a:
                a = c
            break
    i = j+1
print(a)

Submission status: Wrong Answer

Solution code:
l = ["A","T","C","G"]
S = input()
tmp = ""
ans = 0
for s in S:
  if not s in l:
    ans = max(ans,len(tmp))
    tmp = ""
  else:
    tmp += s
for s in S[::-1]:
  if not s in l:
    ans = max(ans,len(tmp))
    tmp = ""
  else:
    tmp += s
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
max_acgt_len = 0

for i in range(len(s)):
    current_str = s[i:]

    for j in reversed(range(1, len(current_str))):
        acgt_count = 0
        acgt_count += current_str[:j].count('A')
        acgt_count += current_str[:j].count('G')
        acgt_count += current_str[:j].count('C')
        acgt_count += current_str[:j].count('T')

        if acgt_count == len(current_str[:j]):
            max_acgt_len = max(max_acgt_len, acgt_count)

print(max_acgt_len)

Submission status: Wrong Answer

Solution code:
import sys

def main():
    input = sys.stdin.readline
    S = [str(c) for c in input().strip()]

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

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#coding: utf-8
S = list(input())
enki = ["A", "T", "G", "C"]
a = []
ans = ""
for i in range(len(S)):
    if S[i] in enki:
        ans += S[i]
    elif S[i] not in enki:
        ans = ""
    a.append(ans)
print(len(max(a)))

Submission status: Wrong Answer

Solution code:
acgt = ["A", "C", "G", "T"]
s = input()
cnt = 0
cnt_max = 0
for c in list(s):
  if c in acgt:
    cnt += 1
  else:
    if cnt > cnt_max:
      cnt_max = cnt
      cnt = 0
print(cnt_max)

Submission status: Wrong Answer

Solution code:
ans=0
for s in raw_input():
  if s not in "ACGT":
    ans+=1
print ans

Submission status: Wrong Answer

Solution code:
s = input()
max_acgt_len = 0

for i in range(len(s)):
    current_str = s[i:]

    for j in reversed(range(1, len(current_str))):
        print('searching: {}'.format(current_str[:j]))
        acgt_count = 0
        acgt_count += current_str[:j].count('A')
        acgt_count += current_str[:j].count('G')
        acgt_count += current_str[:j].count('C')
        acgt_count += current_str[:j].count('T')

        if acgt_count == len(current_str[:j]):
            max_acgt_len = max(max_acgt_len, acgt_count)

print(max_acgt_len)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for c in S:
  if c == 'A' or c == 'C' or c == 'G' or c == 'T':
    count+=1
  else:
    list.append(count)
    count = 0

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

Submission status: Wrong Answer

Solution code:
Ss=[i for i in input()]
anss = []
counter = 0
for i in range(len(Ss)):
    if Ss[i]=="A" and Ss[i]=="C" and Ss[i]!="G" and Ss[i]!="T":
        anss.append(counter)
        counter=0
    else:
        counter+=1
if len(anss)!=0:
    print(max(anss))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
acgt = ["A", "C", "G", "T"]
s = input()
cnt = 0
cnt_max = 0
for c in list(s):
  if c in acgt:
    cnt += 1
  else:
    if cnt > cnt_max:
      cnt_max = cnt
print(cnt_max)

Submission status: Wrong Answer

Solution code:
a = list(input())
ans =[0]
for i in range(len(a)):
    k = 0
    if a[i] == "A"or a[i] == "G"or a[i]=="C"or a[i]=="T":
     for j in range(i,len(a)):
        if a[j] == "A"or a[j] == "G"or a[j]=="C"or a[j]=="T":
            k += 1
        else:
            ans.append(k)



print(max(ans))

Submission status: Wrong Answer

Solution code:
#B問題
S=str(input())
Slist=list(S)
Slen=len(Slist)
MAX=0
for i in range(Slen):
    for j in range(Slen-i-1):
        J=j+i+1
        karis=Slist[i:J+1]
        flag = 0
        for x in karis:
            if x == "A" or x == "T" or x == "C" or x == "G":
                pass
            else:
                flag = 1
                break
        if flag == 0:
            MAX=max(MAX,len(karis))
print(MAX)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
def main():
    s = input()

    got = ""

    current = ""
    for r in s:
        if r in ['A', 'C', 'G', 'T']:
            current += r
        else:
            if len(current) >= len(got):
                got = current
            current = ""

    print(got)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
S = input()

text = ""
ans = 0
for idx, moji in enumerate(S):
    
    if moji == "A" or moji == "C" or moji == "G" or moji == "T":
        text += moji
        for j in range(idx+1,len(S)):
            if S[j] == "A" or S[j] == "C" or S[j] == "G" or S[j] == "T":
                text += S[j]
            else:
                if "T" in text and len(text) > ans:
                    print(text)
                    ans = len(text)
                text = ""
                break
    else:
        text = ""

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
sl = len(s)
dic = {"A":1,"C":1,"G":1,"T":1}
cntmax = 0
for i in range(sl):
    cnt=0    
    for j in range(sl):
        try :
            cnt += dic[s[j]]
        except KeyError:
            if cntmax < cnt:
                # print(str(i)+" "+str(j)+" "+str(cntmax)+" "+str(cnt))
                cntmax = cnt
print(cntmax)

Submission status: Wrong Answer

Solution code:
S=input()
count = 0
for i in reversed(range(len(S))):
    for j in range(0, 7-i):
        S_part = S[j:i+j+1]
        #print(i, j)
        #print(S_part)
        l = list(set(S_part))
        l.sort()
        if set(l)&set(['A','C','G','T'])==set(l):
            count = max(count, len(S_part))
print(count)

Submission status: Wrong Answer

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

for c in S:
  if c == 'A' or c == 'C' or c == 'G' or c == 'T':
    count+=1
  else:
    list.append(count)
    count = 0

if len(list)==0:
    print(0)
else:
    print(max(list))

Submission status: Wrong Answer

Solution code:
S=input()
l=len(S)
s=0
e=0
L=0
max=0
for i in range(l):
	if S[i-1]=="A" or S[i-1]=="T" or S[i-1]=="G" or S[i-1]=="C":
		L=L+1
		if L>max:
			max=L
	else:
		L=0
print(max)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
S = str(input())

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

count = 0
count_list = [0]
list_S = list(S)

for i in range(0, len(list_S)):
  if list_S[i] in acgt_list:
    for j in range(i, len(list_S)):
      if list_S[j] in acgt_list:
        count += 1
      else:
        count_list.append(count)
        count = 0
        break
  else:
    continue
print(max(count_list))

Submission status: Wrong Answer

Solution code:
s=list(input())
n=len(s)
ans=0
tmp=-10
cnt=[0]*10
for i in range(n):
    if s[i]=="A" or s[i]=="C" or s[i]=="G" or s[i]=="T":
        cnt[i]=1
for i in cnt:
    if i==1:
        ans+=1
    else:
        if tmp<ans:
            tmp=ans
            ans=0
print(tmp)

Submission status: Wrong Answer

Solution code:
s = list(input())
list = {"A","T","G","C"}
tmp = 0
count = 0
for i in s:
    if i not in list:
        if count > tmp:
            tmp = count
        count = 0
    count += 1
print(tmp)

Submission status: Wrong Answer

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

import sys

def parse_input(lines_as_string = None):


    lines = []
    if lines_as_string is None:
        lines.append(input())
    else:
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    tokens = lines[0].split(" ")
    s = tokens[0]

    return (s,)


def solve(s):
    
    acgt = set(["A", "C", "G", "T"])

    count = 0
    m = 0
    for i, c in enumerate(s):
        if c in acgt:
            count = count + 1
        else:
            if count > m:
                m = count
            count = 0

    return m

def main():
    # 出力

    print("%s" % solve(*parse_input()))

if __name__ == '__main__':

    main()

Submission status: Wrong Answer

Solution code:
s = input()
def check(a):
    ALLOWED = "ACGT"
    for c in a:
        if not c in ALLOWED:
            return False
    return True

ans = 0
for i in range(len(s)):
    for j in range(len(s) - i):
        tmp = s[i: j]
        if check(tmp):
            ans = max(ans, len(tmp))
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
n = ""
for i in range(len(s)):
  for j in range(i,len(s)):
    if s[i:j].replace("A","").replace("T","").replace("G","").replace("C","")=="":
      if len(s[i:j]) >len(n):
        n = s[i:j]
print(len(n))

Submission status: Wrong Answer

Solution code:
str = input()

def check(text):
  if text=='A' or text=='G' or text=='C' or text=='T':
    return 1
  else:
    return 0

longest=0
sum=0
for i in str:
  if check(i)==1:
    sum+=1
  else:
    if longest<sum:
      longest=sum
      sum=0
    else:
      sum=0
print(longest)

Submission status: Wrong Answer

Solution code:
ans=0
for s in raw_input():
  if s in "ACGT":
    ans+=1
print ans