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=list(input())

def sea(s):
    if s==[]:
        return 0
    max_agct=0
    tem_agct=0
    for i in range(len(s)):
        for j in range(len(s)-i):
            if s[i+j]=="A" or s[i+j]=="G" or s[i+j]=="C" or s[i+j]=="T":
                tem_agct+=1
            else:
                if tem_agct>max_agct:
                    max_agct=tem_agct
                tem_agct=0
                break
                    
    return max_agct

print(sea(s))

Submission status: Wrong Answer

Solution code:
S = input()

count = 0
C = [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:
        C.append(count)
        count = 0
        continue

print(max(C))

Submission status: Wrong Answer

Solution code:
import re

S = input()
ans = re.split(r'[^ATGC]', S)

maxlen = -1
maxarg = 0
for i,a in enumerate(ans):
    if len(a) > maxlen:
        maxlen = len(a)
        maxarg = i
print(ans[maxarg])

Submission status: Wrong Answer

Solution code:
b = input()
ans = ""

for i in range(len(b)):
    if b[i] == "A" or b[i] == "T" or b[i] == "C" or b[i] == "G":
        ans += "1"
    else:
        ans += "0"
#print(ans)

ls = [0]

for i in range(len(b)):
    tmp = 0
#    print("i",i)
    if ans[i] == "1":
        for j in range(len(b) - i):
#            print("j",j)
            if ans[i + j] == "1":
                tmp += 1
            else:
                ls.append(tmp)
                break
#print(ls)
print(max(ls))

Submission status: Wrong Answer

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

begin = 0
acgt = 'ACGT'

while begin < len_S and S[begin] not in acgt:
  begin += 1

end = begin
while end < len_S and S[end] in acgt:
  end += 1

print(end - begin)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import re
import numpy as np
s = input()
s = 'ATKKLSGACKJMSA'
atgcs = re.split(r'[^ATGC]', s)
lens = np.array(list(map(len, atgcs))).max()
print(lens)

Submission status: Wrong Answer

Solution code:
n=input()
l=["A","T","C","G"]
res=0
cnt=0

for i in range(len(n)):
  if n[i] in l:
    if cnt>res:
      res=cnt
    cnt+=1
  else:
    if cnt>res:
      res=cnt
      cnt=0
      
print(res)

Submission status: Wrong Answer

Solution code:
S=list(input())
li = ['A','T','G','C']
maxl=0
leng=0
for i in range(len(S)):
    if S[i] in li:
        leng+=1
    else:
        if leng>maxl:
            maxl=leng
        leng=0
print(maxl)

Submission status: Wrong Answer

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

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
    for j in s[i:]:
        #print(j)
        if j in l:
            tmp += 1
        else:
            res = max(res,tmp)
            #print(res)
            break
else:
    print(res)

Submission status: Wrong Answer

Solution code:
s = list(input())
l = ['A', 'T', 'C', 'G']
max_cnt = 0
cnt = 0
for i in range(len(s)):
    if s[i] in l:
        cnt += 1
    elif s[i] not in l:
        if cnt != 0 and max_cnt < cnt:
            max_cnt = cnt
        cnt = 0
print(max_cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()

count = 0
max_length = 0
for i in S:
    if i in ('A', 'T', 'C', 'G'):
        count += 1
    else:
        if count > max_length:
            max_length = count
        count = 0

print(max_length)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = input()
a = a.replace("A","0")
a = a.replace("C","0")
a = a.replace("G","0")
a = a.replace("T","0")
print(a.count("0"))

Submission status: Wrong Answer

Solution code:
s = list(input())
l = ["A","T","G","C"]
maxLen = 0
for i in range(len(s)):
    if s[i] in l:
        for j in range(i, len(s)):
            currLen = j - i
            if not s[j] in l:
                if currLen > maxLen:
                    maxLen = currLen
                break
print(maxLen)

Submission status: Wrong Answer

Solution code:
test = input()

ans = 0

if set(list(test)) <= {'A','C','G','T'}:
    ans = len(test)

for i in range(10):
    for j in range(10):
        if set(list(test[i:-j])) <= {'A','C','G','T'}:
            ans = max(ans,len(test[i:-j]))

print(ans)

Submission status: Wrong Answer

Solution code:
import re
S = input()
ans = []
for i in range(len(S)):
    for k in range(i, len(S)):
        ans.append(S[i:k+1])
ans = sorted(ans,key=lambda x:len(x),reverse=True)
for i in ans:
    if len(re.sub("[ACGTacgt]", "", i)) == 0:
        print(len(i))
        break

Submission status: Wrong Answer

Solution code:
s = input()
det = 'ACGT'
maxc = 0
for i in range(len(s)):
    for p in range(i, len(s)):
        cnt = 0
        for o in s[i:p]:
            if o in det:
                cnt += 1
            else:
                if cnt > maxc:
                    maxc = cnt
                    break
                else:
                    break
print(maxc)

Submission status: Wrong Answer

Solution code:
s=list(input())

def sea(s):
    max_agct=0
    tem_agct=0
    for i in range(len(s)):
        for j in range(len(s)-i):
            if s[i+j]=="A" or s[i+j]=="G" or s[i+j]=="C" or s[i+j]=="T":
                tem_agct+=1
            else:
                if tem_agct>max_agct:
                    max_agct=tem_agct
                tem_agct=0
                break
                    
    return max_agct

print(sea(s))

Submission status: Wrong Answer

Solution code:
import re

S=input()

ss = re.sub('[^A, T, C, G]', ',', S)
sss = ss.split(',')
ans = ""
for i in sss:
  if len(ans) < len(i):
    ans = i
print(ans)

Submission status: Wrong Answer

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

print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()

max_len = 0
len = 0
for e in s:
    if e == 'A' or e == 'C' or e == 'G' or e == 'T':
        len += 1
    else:
        if max_len < len:
            max_len = len
        len = 0

print(max_len)

Submission status: Wrong Answer

Solution code:
from sys import stdin

S = stdin.readline().rstrip()
print(S)
countlist = []

count = 0
for s in S:
    print(s)
    if s == "A" or s == "C" or s == "G" or s == "T":
        count += 1
    else:
        countlist.append(count)
        count = 0
countlist.append(count)
print(max(countlist))

Submission status: Wrong Answer

Solution code:
S = input()
ans = 0
ans_lis = [0]
for x in S:
    if x == 'A' or x == 'C'or x == 'G' or x == 'T':
        ans += 1
    else:
        ans_lis.append(ans)
        ans = 0
print(max(ans_lis))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
for i in range(len(s)):
    if s[i] in ["A", "C", "G", "T"]:
        break
for j in range(i, len(s) + 1):
    if j == len(s):
        break
    if s[j] not in ["A", "C", "G", "T"]:
        break
print(j - i)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=list(input())
ans=0
for i in range(len(s)):
  q=''.join(s)
  q=q.rstrip("ATGC")
  ans=max(ans,len(s)-len(q))
  s.append(s.pop(0))
print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
S = input()
count = 0
add = ""
for i in S:
    if i in ["T", "A", "G", "C"]:
        add += i
        if len(add) == len(S):
            count = len(add)
            break
    else:
        if len(add) >= count:
            count = len(add)
        add = ""
print(count)

Submission status: Wrong Answer

Solution code:
from sys import stdin
import math
import itertools


def makeIntMatrix(lines):
    intMatrix = []
    for a in makeStringMatrix(lines):
        intMatrix += [int(b) for b in a]
    return intMatrix


def makeStringMatrix(lines):
    stringMatrix = [line.split() for line in lines]
    return stringMatrix


def makeInt(line):
    return int(line.rstrip())


def makeMultiInteger(line):
    return [int(x) for x in line.rstrip().split()]


def solve(input_string):
    S = input_string
    cnt = 0
    maxCnt = 0
    for N in S:
        if N == 'A':
            cnt += 1
        elif N == 'T':
            cnt += 1
        elif N == 'G':
            cnt += 1
        elif N == 'C':
            cnt += 1
        else:
            if cnt > maxCnt:
                maxCnt = cnt
            cnt = 0
    return maxCnt


def main():
    input_lines = stdin.readline().rstrip()
    answer = solve(input_lines)
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import re
import numpy as np
s = input()
atgcs = re.split(r'[^ATGC]', s)
lens = np.array(list(map(len, atgcs)))
ret = atgcs[lens.argmax()]
print(ret)

Submission status: Wrong Answer

Solution code:
import numpy as np

s=input()
isContinue=0
part=[0]

for c in s:
    if c=='A' or c=='T' or c=='C' or c=='G':
        isContinue+=1
    else:
        part.append(isContinue)
        isContinue=0

print(max(part))

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

Submission status: Wrong Answer

Solution code:
s=list(input())
f=0

for i in range(len(s)):
    if s[i]=='A' or s[i]=='C' or s[i]=='T' or s[i]=='G':
        f+=1
    
print(f)

Submission status: Wrong Answer

Solution code:
#coding:utf-8
s = input()
tmp = 0
ans = 0
for i in s:
  if i in ('A','G','C','T'):
    tmp += 1
  elif ans < tmp:
    ans = tmp
    tmp = 0
  else:
    tmp = 0

print(ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

S = input()
count = 0
count_max = 0

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

Submission status: Wrong Answer

Solution code:
s= input()

c=0
max= 0
for i in s:
  if (i == 'A') or (i == 'T') or (i == 'G') or (i == 'C'):
    c+= 1
  else:
    if(c> max):
      max= c
    c=0

print(max)

Submission status: Wrong Answer

Solution code:
s = list(input())
l = ['A', 'T', 'C', 'G']
max_cnt = 0
cnt = 0
for i in range(len(s)):
    if s[i] in l:
        cnt += 1
    elif s[i] not in l:
        if cnt != 0: max_cnt = cnt
        cnt = 0
print(max_cnt)

Submission status: Wrong Answer

Solution code:
import re
import numpy as np
s = 'ATGCKKAA'
s = input()
atgcs = re.split(r'[^ATGC]', s)
lens = np.array(list(map(len, atgcs)))
ret = atgcs[lens.argmax()]
print(ret)

Submission status: Wrong Answer

Solution code:
txt=input()
big=0
temp=0
ans=''
for t in txt:
	if(t=='A'):
		ans+='1'
	elif(t=='G'):
		ans+='1'
	elif(t=='C'):
		ans+='1'
	elif(t=='T'):
		ans+='1'
	else:
		ans+='0'

for t in ans:
	if(t=='1'):
		temp+=1
	else:
		if(big<temp):
			big=temp
		temp=0
        
if(len(txt)==1):
	if(txt=='A' or txt=='G' or txt=='C' or txt=='T'):
		print(1)
	else:
		print(0)
else:
	print(big)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()

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

count = 0
ans = 0
for s in S:
    if s in sub_str:
        count += 1
    else:
        ans = max(ans, count)
        count = 0
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()

acgt = set(['A', 'C', 'G', 'T'])

max_count = 0
count = 0
for s in S:
    if s in acgt:
        count += 1
    else:
        if max_count < count:
            max_count = count
        count = 0

print(max_count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = list(input())
ansarr = []
ans = 0
ansarr.append(ans)
for i in S:
    if ans == 0:
        if i == 'A' or i == 'C' or i == 'G' or i == 'T':
            ans += 1
    else:
        if i == 'A' or i == 'C' or i == 'G' or i == 'T':
            ans += 1
        elif i != 'A' or i != 'C' or i != 'G' or i != 'T':
            ansarr.append(ans)
            ans = 0

print(max(ansarr))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
word = input()
print(len(word.strip("QWERYUIOPSDFHJKLZXVBNM")))

Submission status: Wrong Answer

Solution code:
s = input()
anslist = [0]
ans = 0
acgt = ["A", "C", "G", "T"]
for e in s:
  if e in acgt:
    ans += 1
  else:
    anslist.append(ans)
    ans = 0
print(max(anslist))

Submission status: Wrong Answer

Solution code:
S=raw_input()
C="ACGT"

len_S=len(S)

ans=float("-inf")
for i in range(len_S):
	for j in range(i,len_S):
		s=S[i:j]
		for x in s:
			if x not in C:
				break
		else:
			ans=max(ans,len(s))

print ans

Submission status: Wrong Answer

Solution code:
from sys import stdin

def main():
    S = input()

    ans, cnt = 0, 0
    for s in S:
        if s in {'A', 'C', 'G', 'T'}:
            cnt += 1
        else:
            ans = max(ans, cnt)
            cnt = 0
    print(ans)

input = lambda: stdin.readline().rstrip()
main()

Submission status: Wrong Answer

Solution code:
S = input()

cntMax = 0
cnt = 0

for s in S:
    #print(s)
    if s == 'A' or s == 'C' or s == 'G' or s == 'T':
        cnt += 1
    else:
        cntMax = max(cntMax, cnt)
        cnt = 0

print(cntMax)

Submission status: Wrong Answer

Solution code:
a = input()
lis = []
li = ["A","C","G","T"]
l = []
for i in range(len(a)):
    if a[i] in li:
        lis.append(a[i])
    else:
        l.append(lis)
        lis = []
ans = []
for n in l:
    if len(ans) < len(n):
        ans = n
print(len(ans))

Submission status: Wrong Answer

Solution code:
s=list(input())
ans=0
for i in range(len(s)):
  q=''.join(s)
  q=q.strip("ATGC")
  ans=max(ans,len(s)-len(q))
  s.append(s.pop(0))
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
base = ['A', 'T', 'C', 'G']
print(len([c for c in S if c in base]))

Submission status: Wrong Answer

Solution code:

AGCT = "AGCT"

S = input()

longest = ""
tmpCounter = 0
for i in range(len(S)):
	# print(i, tmpCounter, longest)
	if S[i] in AGCT:
		tmpCounter += 1
	else:
		if tmpCounter > len(longest):
			longest = S[i - tmpCounter: i]
		tmpCounter = 0

print(len(longest))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = str(input())
n = len(S)
L = ["A","C","G","T"]
w = [0]
for i in range(n):
    if S[i] in L:
        cnt = 0
        for j in range(i,n):
            if S[j] not in L:
                cnt += 1
                w.append(len(S[i:j]))
        if cnt == 0:
            w.append(len(S[i::]))
print(max(w))

Submission status: Wrong Answer

Solution code:
import re
s = input()
ret = set()
pattern = '[ACGT]*'
for i in range(len(s)):
    s1 = s[i:]
    for j in reversed(range(len(s1))):
        s2 = s1[:j]
        if re.fullmatch(pattern, s2) is not None:
            ret.add(len(s2))
print(max(ret))

Submission status: Wrong Answer

Solution code:
ss = str(input())

n = 0
for s in ss:
    if s in ["A","G","T","C"]:
        n += 1
print(n)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import collections

def main():
	S = input()
	S = list(S)
	
	ans = 0
	for i, vol in enumerate(S):
		tmp = 0
		if vol == "A" or vol == "C" or vol == "G" or vol == "T":
			tmp += 1
			for j in range(i+1, len(S)-1):
				if S[j] == "A" or S[j] == "C" or S[j] == "G" or S[j] == "T":
					tmp += 1
				else:
					break
			if ans < tmp:
				ans = tmp
			
		
	
	print(ans)
			
if __name__ == "__main__":
	main()

Submission status: Wrong Answer

Solution code:
s_list = list(input())
str_list = ['A','C','G','T']
now_max = 0
for i,s in enumerate(s_list):
    if s in str_list:
        l = 1
        for next in s_list[i+1:]:
            if next in str_list:
                l += 1
            else:
                now_max = max(l,now_max)
print(now_max)

Submission status: Wrong Answer

Solution code:
S = input()

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

print(str(count))

Submission status: Wrong Answer

Solution code:
S = input()

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

cnt = 0
ans = 0
for s in S:
    if s in ch:
        cnt += 1
    else:
        ans = max(ans, cnt)
        cnt = 0

print(ans)

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:
        anss.append(counter)
        counter+=1
print(max(anss))

Submission status: Wrong Answer

Solution code:
s = input()
for i in range(len(s)):
    if s[i] in ["A", "C", "G", "T"]:
        break
for j in range(i, len(s)):
    if s[j] not in ["A", "C", "G", "T"]:
        break
print(j - i)

Submission status: Wrong Answer

Solution code:
S = list(input())
cnt = 0
max_cnt = 0
for s in S:
        if s == 'A' or s == 'C' or s == 'G' or s == 'T':
                cnt = cnt + 1
        else:
                if max_cnt < cnt:
                        max_cnt = cnt
                cnt = 0
print(max_cnt)

Submission status: Wrong Answer

Solution code:
S = input()

count = 0
C = [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:
        C.append(count)
        count = 0

print(max(C))

Submission status: Wrong Answer

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

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

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
char = input()

max_num = 0
max_seq = ''

def include(char):
    for c in char:
        if c not in ['A', 'T', 'G', 'C']:
            return False
    return True

for i in range(len(char)):
    for j in range(i, len(char)):
        sub = char[i:j]
        if include(sub):
            if max_num < len(sub):
                max_num = len(sub)
                max_seq = sub

print(max_num)

Submission status: Wrong Answer

Solution code:

s = input()

max_acgt = ''
candidate = ''
for bs in s:
    if 'A' == bs or 'T' == bs or 'G' == bs or 'C' == bs:
        candidate += bs
    elif candidate != '':
        if len(max_acgt) < len(candidate):
            max_acgt = candidate
            candidate = ''
else:
    print(len(max_acgt))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys


def solve(S: str):
    sl = {'A', 'C', 'G', 'T'}

    T = list(S)
    c = 0
    ans = 0
    for i in range(len(T)):
        if(T[i] in sl):
            c += 1
            continue
        else:
            ans = max(ans,c)
            c = 0
    print(ans)
    return


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = str(input())
cont = 0
ans = 0
for s in S:
    if s == 'A' or s == 'C' or s == 'G' or s == 'T':
        cont += 1
    else:
        if ans < cont:
            ans = cont
        cont = 0
print(ans)

Submission status: Wrong Answer

Solution code:
S = list(raw_input())

mx_cnt = 0
cnt=0

for c in S:
    if (c == 'A') or (c == 'T') or (c == 'G') or (c == 'C') :
        cnt += 1
    else:
        if cnt > mx_cnt:
            mx_cnt = cnt
        cnt = 0

print mx_cnt

Submission status: Wrong Answer

Solution code:
import re
S = input()

ans = [S]
for i in range(len(S)):
    for k in range(i, len(S)):
        ans.append(S[i:k])
ans = sorted(ans,key=lambda x:len(x),reverse=True)
for i in ans:
    if len(re.sub("[ACGTacgt]", "", i)) == 0:
        print(len(i))
        break

Submission status: Wrong Answer

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

cnt = 0
maxCnt = 0
for s in S:
  if s in arr:
    cnt += 1
  else:
    if maxCnt < cnt:
      maxCnt = cnt
      cnt = 0
if maxCnt == 0:
  maxCnt = cnt
print(maxCnt)

Submission status: Wrong Answer

Solution code:
b=list(input())
enki=["A","T","G","C"]
print(sum([(i in enki) for i in b]))

Submission status: Wrong Answer

Solution code:
S = list(input())

len1 = 0
judge = 0
for i in range(len(S)):
  if((S[i] == 'A')or(S[i] == 'T')or(S[i] == 'G')or(S[i] == 'C')):
    len1 += 1
    judge = 1
  if(judge != 0):
    if((S[i] == 'A')or(S[i] == 'T')or(S[i] == 'G')or(S[i] == 'C')):
      continue
    else:
      break

S.reverse()
len2 = 0
judge = 0
for i in range(len(S)):
  if((S[i] == 'A')or(S[i] == 'T')or(S[i] == 'G')or(S[i] == 'C')):
    len2 += 1
    judge = 1
  if(judge != 0):
    if((S[i] == 'A')or(S[i] == 'T')or(S[i] == 'G')or(S[i] == 'C')):
      continue
    else:
      break
      
max_len = max(len1,len2)
print(max_len)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import collections

def main():
	S = input()
	S = list(S)
	
	ans = 0
	for i, vol in enumerate(S):
		tmp = 0
		if vol == "A" or vol == "C" or vol == "G" or vol == "T":
			tmp += 1
			for j in range(i+1, len(S)-1):
				if S[j] == "A" or S[j] == "C" or S[j] == "G" or S[j] == "T":
					tmp += 1
			if ans < tmp:
				ans = tmp
			
		
	
	print(ans)
			
if __name__ == "__main__":
	main()

Submission status: Wrong Answer

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


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


x = raw_input()


count = []
c = 0
for s in x:
    print s,
    a = is_acgt(s)
    if a == 0:
        print 'False'
        count.append(c)
        c = 0
        continue
    else:
        print 'True'
        c += 1

    count.append(c)

if len(count)==0:
    print 0
    exit()
print max(count)

Submission status: Wrong Answer

Solution code:
s = input()
letters = ["A","G","C","T"]
counter = 0
record = 0

for letter in s:
    if letter in letters:
        counter += 1
    else:
        counter = 0
else:
    record = max(record,counter)
    print(record)

Submission status: Wrong Answer

Solution code:
S = list(input())  # 一文字ずつ格納
ans = 0
tmp = 0
for s in S:
    if s != "A" and s != "T" and s != "G" and s != "C":
        ans = max(ans, tmp)
        tmp = 0
    else:
        tmp += 1

print(ans)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
#coding:utf-8
s = input()
tmp = 0
ans = 0
for i in s:
  if i in ('A','G','C','T'):
    tmp += 1
  elif ans < tmp:
    ans = tmp
    tmp = 0

print(ans)

Submission status: Wrong Answer

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

for i in range(len(s)):
    for j in range(i + 1, len(s)):
        f = True
        for ss in s[i:j]:
            if ss not in a:
                f = False

        if f:
            ans = max(ans, len(s[i:j]))

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()

acgt = 'ACGT'

max_len = 0
for i in range(len(s)):
    j = 0
    while i + j < len(s):
        if s[i + j] not in acgt:
            if max_len < j:
                max_len = j
            break
        j += 1

print(max_len)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = str(input())
a = 0
b = ["A", "T", "G", "C"]
c = ""
for s_ in s:    
    if s_ in b:
        c = c + s_
    else:
        a = max(len(c), a)
        c = ""
print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S=str(input())

acgt=False
length=0
maxlen=0
for i in S:
  if acgt:
    if i=="A" or i=="G" or i=="C" or i=="T":
      length += 1
    else:
      maxlen = max(maxlen, length)
      acgt = False
  else:
    if i=="A" or i=="G" or i=="C" or i=="T":
      length = 1
      acgt = True
    else:
      continue

print(maxlen)

Submission status: Wrong Answer

Solution code:
test = input()

ans = 0

for i in range(10):
    for j in range(10):
        if set(list(test[i:j])) <= {'A','C','G','T'}:
            ans = max(ans,len(test[i:j]))

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
chars = ''
ans = 0
acgt = ['A', 'C', 'G', 'T']
for char in S:
  if char in acgt:
    chars+=char
  else:
    ans = max(ans, len(chars))
    chars = ''
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
maxsum = 0
sum = 0
for i in range(len(s)):
    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
        sum += 1
    else:
        if sum > maxsum:
            maxsum = sum
        sum = 0
print(maxsum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
ans = 0
for i in range(1,len(s)):
    for j in range(len(s)-i):
        flag = True
        for c in s[j:j+i]:
            if c not in ["A","G","C","T"]:
                flag = False
        if flag:
            ans = max(i,ans)
flag = True
for c in s:
    if c not in ["A","G","C","T"]:
        flag = False
if flag:
    ans = len(s)
print(ans)