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()
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()
max_acgt_len = 0

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

    for j in reversed(range(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:
S=input()
slist=[]
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:
        ma = max(ma, len(s))
print(ma)

Submission status: Wrong Answer

Solution code:
N = input()
charlist = list(N)
hoge = 0
maxscore = 0
def onon(char, hogehoge):
    nowscore = 0
    while char[hogehoge] == "A" or char[hogehoge] == "T" or char[hogehoge] == "G" or char[hogehoge] == "C" :
        hogehoge = hogehoge + 1
        nowscore += 1
        if hogehoge + 1 >= len(char):
            break
    return nowscore 
for i in charlist:
    score = 0
    if i == "A" or i == "T" or i == "G" or i == "C"  :
        score = onon(charlist,hoge)
    if maxscore <= score:
        maxscore = score
    hoge = hoge + 1
print(maxscore)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

str = input()
x = len(str)
count = 0
tmp_c = 0

for i in range(x):
    if str[i:i+1] == 'A' or str[i:i+1] == 'T' or str[i:i+1] =='C' or str[i:i+1] == 'G':
        tmp_c = tmp_c + 1
        continue
    else:
        if count < tmp_c:
            count = tmp_c
        tmp_c = 0

    if i+1 == x:
        break

print(count)

Submission status: Wrong Answer

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

ans = 0
for i in range(len(S)-1):
    for j in range(i+1,len(S)+1):
        s = S[i:j]
        flag = 0
        for ss in s:
            if not (ss in ch):
                flag = 1
                break
        if flag == 0:
            ans = max(ans, len(s))

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
start = 0
max = 0
count = 0
for i in range(len(S)):
    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 = input()
li = [-1]
ans = 0
for index,i in enumerate(S):
    if(i!='A' and i!='C' and i!='G' and i!='T'):
        li.append(index)
if(len(li)==1):
    print(len(S))
else:
    for index,i in enumerate(li):
        if(not index==0):
            ans = max(ans,li[index]-li[index-1]-1)

    print(ans)

Submission status: Wrong Answer

Solution code:
# 1文字ずつ格納
a = [str(i) for i in input()] 
max=0
ans=0


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

if ans >= 11:
    ans=10
    
print(ans)

Submission status: Wrong Answer

Solution code:
from itertools import product

S = input()
T = set()
for i in range(len(S)):
  for j in range(len(S)):
    T.add(S[i:i+j+1])

check = []
for i in range(len(S)):
  for per in product(["A","C","G","T"], repeat = i):
    per = "".join(per)
    check.append(per)
check = list(set(check))

ans = 0
for t in T:
  tt = "".join(t)
  if(tt in check):
    ans = max(ans, len(tt))
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()

acgt = [False for i in range(len(s)+1)]
for i in range(len(s)):
	if s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T':
		acgt[i+1] = True
	else:
		acgt[i+1] = False

count = 0
max = 0
iss = False
for i in range(1, len(acgt)):
	if not acgt[i-1] and acgt[i]:
		iss = True
	elif acgt[i-1] and not acgt[i]:
		iss = False
		if max < count:
			max = count
		count = 0
	if iss and acgt[i]:
		count += 1

print(max)

Submission status: Wrong Answer

Solution code:
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()
S = list(S)
cnt = 0
maxcount = 0
print(S)

for i in range(len(S)):
    if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
        cnt += 1
        if cnt > maxcount:
            maxcount = cnt
    else:
        cnt = 0
print(maxcount)

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[i:])):
            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=list(input())
lst=['A','T','G','C']
l=len(s)
ans=[[]]

for i  in range(l-1):
  for j in range(i+1,l+1):
    a=True
    L=s[i:j]
    
    for k in L:
      if k not in lst:
        a=False
        break
    if a:
      ans.append(L)
num=0

for i in ans:
  num=max(num,len(i))
print(num)

Submission status: Wrong Answer

Solution code:
S = input()

count = 0
C = []
for i in range(len(S)):
  C.append(count)
  count = 0
  if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
    count += 1
    if(i == len(S)-1): break
    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: break

print(max(C))

Submission status: Wrong Answer

Solution code:
from itertools import product

S = input()
T = set()
for i in range(len(S)):
  for j in range(len(S)):
    T.add(S[i:i+j])

check = []
for i in range(len(S)):
  for per in product(["A","C","G","T"], repeat = i):
    per = "".join(per)
    check.append(per)
check = list(set(check))

ans = 0
for t in T:
  tt = "".join(t)
  if(tt in check):
    ans = max(ans, len(tt))
print(ans)

Submission status: Wrong Answer

Solution code:
S = list(input())
m = 0
count = 0

for i in range(len(S)):
    for j in range(i+1, len(S)):
        count = 0
        for s in list(S[i:j+1]):
            if s in ['A', 'G', 'T', 'C']:
                count += 1
                
            else:
                if m <= count:
                    m = count
                count = 0
print(m)

Submission status: Wrong Answer

Solution code:
S = input()

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

res = 0

for i in range(len(S)+1):
    for j in range(len(S)+1):
        flag = True
        for k in S[i:-j]:
            if k not in st:
                flag = False

        if flag:
            res = max(res,len(S[i:-j]))

print(res)

Submission status: Wrong Answer

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

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

print(max(x))

Submission status: Wrong Answer

Solution code:
s = input()
l = len(s)
c = 0
i = 0
cnt = 0
while i < l:
    if any([s[i]=='A',s[i]=='C',s[i]=='G',s[i]=='T']):
        cnt = 1
        i += 1
        if i == l:
            break
        while any([s[i]=='A',s[i]=='C',s[i]=='G',s[i]=='T']):
            cnt += 1
            i += 1
            if i >= l:
                break
    c = max(c,cnt)
    i += 1
print(c)

Submission status: Wrong Answer

Solution code:
x=input()
count=0
flag=0
countList=[]
for i in range(len(x)):
    if x[i]=='A' or x[i]=='T' or x[i]=='C' or x[i]=='G':
        if flag==0:
            flag=1

        count=count+1
    else:
        if flag==1:
            flag=0
            countList=countList+[count]
            count=0

if countList==[]:
    print('0')
else:
    print(str(max(countList)))

Submission status: Wrong Answer

Solution code:
S = input()

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

res = 0

for i in range(len(S)):
    for j in range(len(S)+1):
        #print(S[i:-j])
        flag = True
        for k in S[i:-j]:
            if k not in st:
                flag = False

        if flag:
            res = max(res,len(S[i:-j]))

print(res)

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
print(max(count_list))

Submission status: Wrong Answer

Solution code:
N = input()
charlist = list(N)
hoge = 0
maxscore = 0
def onon(char, hogehoge):
    nowscore = 0
    while char[hogehoge] == "A" or char[hogehoge] == "T" or char[hogehoge] == "G" or char[hogehoge] == "C" :
        hogehoge = hogehoge + 1
        nowscore += 1
        if hogehoge + 2 >= len(char):
            break
    return nowscore 
for i in charlist:
    score = 0
    if i == "A" or i == "T" or i == "G" or i == "C"  :
        score = onon(charlist,hoge)
    if maxscore <= score:
        maxscore = score
    hoge = hoge + 1
print(maxscore)

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 "C":count+=1
    elif s in "G":count+=1
    elif s in "T":count+=1
    else:
        M=max(M,count)
        count=0
print(M)

Submission status: Wrong Answer

Solution code:
s = list(input())

li = []
result = []
pre = 0

for i in s:
	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)
	elif pre==1:
		if len(li)>len(result):
			result = li
		li=[]
		break

print(len(result))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=input()
slist=[]
for i in range(len(s)):
    for j in range(i+1, len(s)):
        slist.append(s[i:j])
ma=0
for s1 in slist:
    flag = True
    for s2 in s1:
        if s2 not in 'ATGC':
            flag = False
    if flag:
        ma = max(ma, len(s1))
print(ma)

Submission status: Wrong Answer

Solution code:
def main():
    a = ['A', 'T', 'G', 'C']
    S = input()
    l = 0
    L = 0
    for s in S:
        if s in a:
            l += 1
        else:
            if l > L:
                L = l
            l = 0
    print(L)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
list = list(input())

cnt = 0
tmp = 0
for row in list:
    if row in ('ACGT'):
        tmp += 1
    else:
        if tmp > cnt:
            cnt = tmp
        tmp = 0

print(cnt)

Submission status: Wrong Answer

Solution code:
string_list = list(input())
string_len = len(string_list)
renzoku_list = []

def find_letter():
  renzoku = 0
  for i in range(string_len):
    if string_list[i]=='A':
      renzoku += 1
    elif string_list[i]=='C':
      renzoku += 1
    elif string_list[i]=='G':
      renzoku += 1
    elif string_list[i]=='T':
      renzoku += 1
    else:
      renzoku_list.append(renzoku)
      renzoku = 0

if 'A' in string_list:
  find_letter()
elif 'C' in string_list:
  find_letter()
elif 'G' in string_list:
  find_letter()
elif 'T' in string_list:
  find_letter()
else:
  print(0)
  
if renzoku_list:
  max_len = max(renzoku_list)
  print(max_len)

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
if maxCnt == 1:
  maxCnt = 0
print(maxCnt)

Submission status: Wrong Answer

Solution code:
s = input()

count = 0
ans = 0

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

print(ans)

Submission status: Wrong Answer

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

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 len(text) > ans:
                    ans = len(text)
                text = ""
                break
    else:
        text = ""

print(ans)

Submission status: Wrong Answer

Solution code:
S = list(input())


for i in range (len(S)):
    if S[i] == "A":
        S[i] = "1"
    elif S[i] == "G":
        S[i] = "1"
    elif S[i] == "C":
        S[i] = "1"
    elif S[i] == "T":
        S[i] = "1"

S2 = "".join(S)

for i in range (len(S))[::-1]:
    A = "".join("1" * i)
    if A in S2:
        print(i)
        break

Submission status: Wrong Answer

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

for i  in range(l-1):
  for j in range(i+1,l):
    a=True
    L=s[i:j]
   
    for k in L:
      if k not in lst:
        a=False
        break
    if a:
      ans.append(L)
num=0

for i in ans:
  num=max(num,len(i))
print(num)

Submission status: Wrong Answer

Solution code:
s=input()
l=len(s)
max=0
Max=0
i=0
while i < l:
    if s[i]=="A" or s[i]=="C" or s[i]=="G" or s[i]=="T":
        i+=1
        max+=1
    else:
        i+=1
        if max>Max:
            Max=max
        max=0

print(Max)

Submission status: Wrong Answer

Solution code:
S = input()
T = set()
for i in range(len(S)):
  for j in range(len(S)):
    T.add(S[i:i+j])
from itertools import product
check = []
for i in range(11):
  for per in product(["A","C","G","T"], repeat = i):
    per = "".join(per)
    check.append(per)
check = list(set(check))

ans = 0
for t in T:
  tt = "".join(t)
  if(tt in check):
    ans = max(ans, len(tt))
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()

L = []
cnt = 0
for i in S:
  if i == "A" or i == "C" or i == "G" or i == "T":
    cnt += 1
  else:
    L.append(cnt)
    cnt = 0

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

Submission status: Wrong Answer

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

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
    for N in S[::-1]:
        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:
string = input()
pattern = ["A","C","G","T"]

c = 0
result = []
for i in string:
    if i in pattern:
        c += 1
    else:
        result.append(c)
        c = 0
if len(result) == 0:
    print(len(string))
else:
    print(max(result))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()

count = 0
C = [0]
for i in range(len(S)-1):
  count = 0
  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)
        break

print(max(C))

Submission status: Wrong Answer

Solution code:
S = input()

ATGC = ['A','T','G','C']
count = 0
goukei = []
for i in range(len(S)):
	count = 0
	for j in range(i,len(S)):
		if(S[j] in ATGC):
			count += 1
			if(j == len(S) - i -1):
				goukei.append(count)
		else:
			goukei.append(count)
			break
print(max(goukei))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
t = ""
ans = 0
tmp = 0
for i in range(len(s)):
    for j in range(i, len(s)):
        if s[j] in ["A", "G", "C", "T"]:
            t += s[j]
        else:
            tmp = max(tmp, len(t))
            t = ""
            ans = 0

            break
print(tmp)

Submission status: Wrong Answer

Solution code:
b = input()

count = 0
max_count = 0
for s in b:
  if s == "A" or s == "C" or s == "G" or s == "T":
    count += 1
  else:
    if max_count < count:
      max_count = count
    count = 0
if max_count == 0:
  	max_count = count
print(max_count)

Submission status: Wrong Answer

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

ans = 0
for i in range(len(S)-1):
    for j in range(i+1,len(S)):
        s = S[i:j]
        flag = 0
        for ss in s:
            if not (ss in ch):
                flag = 1
                break

        else:
            ans = max(ans, len(s))

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
  l = input().split()
  counter = 0
  max = 0
  for s in l:
    if s == 'A' or s == 'G' or s == 'C' or s == 'T':
      counter += 1
      if max <= counter:
        max = counter
    else:
      counter = 0
  print(max)

Submission status: Wrong Answer

Solution code:
S = input()

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

res = 0

for i in range(len(S)):
    for j in range(i,len(S)):
        flag = True
        for k in S[i:-j]:
            if k not in st:
                flag = False

        if flag:
            res = max(res,len(S[i:-j]))

print(res)

Submission status: Wrong Answer

Solution code:
S = input()

def acgt(s):
    tmp = list(s)
    cnt = 0
    for t in tmp:
        if t in ['A', 'G', 'C', 'T']:
            cnt += 1
    #print(cnt)
    return cnt == len(tmp)

#rstrip, lstrip一個づつ見ればいい
rmax, lmax = '', ''
for i in range(len(S)):
    tmp = S.rstrip(S[-i:])
    if acgt(tmp) and tmp > rmax:
        rmax = tmp
for i in range(len(S)):
    tmp = S.lstrip(S[:i])
    if acgt(tmp) and tmp > lmax:
        lmax = tmp

#print(rmax, lmax)
print(max(len(rmax), len(lmax)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
S = input()
ans = 0
for l in range(len(S)):
    for r in range(len(S)):
        if l < r and all(S[k] in list('ACGT') for k in range(l, r)):
            ans = max(ans, r - l)
print(ans)

Submission status: Wrong Answer

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

n = 0
best_n = 0
length = len(S)

for i in range(length):
    if (S[i] not in ['A', 'C', 'G', 'T']) or i == length - 1:
        if (n > best_n):
            best_n = n
            n = 0
    else:
        n += 1
print(best_n)

Submission status: Wrong Answer

Solution code:
S = input()
list = ['A', 'C', 'G', 'T']
answer = 0
current = 0
for i in S:
    if i not in list:
        if answer < current:
            answer = current
        current = 0
    else:
        current += 1
print(answer)

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
    if max_score <= score:
      max_score = score
  else:
    if max_score <= score:
      max_score = score
    score = 0
  print(max_score,score)
 
      
print(max_score)

Submission status: Wrong Answer

Solution code:
S = list(input())
answer = 0

for i in range(len(S)):
    counter = 0
    for j in range(i,len(S)):
        if S[j] == "A" or S[j] == "C" or S[j] == "G" or S[j] == "T":
            counter += 1
            
        else:
            if counter > answer:
                answer = counter
            break
print(answer)

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
  else:
    c.append(t)
    t=0
print(max(c))

Submission status: Wrong Answer

Solution code:
import re
S = input()

pattern = '[A|C|G|T]+'

# findall 
results = re.findall(pattern, S, re.S)

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
s = input()
start = min(s.find('A'), s.find('T'), s.find('G'), s.find('C'))
pos = 0
sol = 0
for i in range(start, len(s)):
    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

print(sol)

Submission status: Wrong Answer

Solution code:
a = input()

part = ""
s = ["A","C","G","T"]
ans = [""]

for i in a:
    
    if  i not in s:
        part = ""
    else:
        part += i
    ans.append(part)

print(len(max(ans)))

Submission status: Wrong Answer

Solution code:
x=input()
count=0
flag=0
countList=[]
for i in range(len(x)):
    if x[i]=='A' or x[i]=='T' or x[i]=='C' or x[i]=='G':
        if flag==0:
            flag=1

        count=count+1
    else:
        if flag==1:
            flag=0
            countList=countList+[count]
            count=0

if countList==[]:
    print(0)
else:
    print(max(countList))

Submission status: Wrong Answer

Solution code:
a = input()
lis = []
li = ["A","C","G","T"]
l = []
for i in range(len(a)):
    if len(a) == 1:
        l.append(a[i])
    elif 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())
answer = 0

for i in range(len(S)):
    counter = 0
    for j in range(i,len(S)):
        if S[j] == "A" or S[j] == "C" or S[j] == "G" or S[j] == "T":
            counter += 1
            print(counter)
        else:
            if counter > answer:
                answer = counter
            break
print(answer)

Submission status: Wrong Answer

Solution code:
S = str(input())

Y = list(S)
Z =[]
cnt = 0

for i in range(len(Y)):
    if Y[i] == "A" or Y[i] == "T" or Y[i] ==  "C" or Y[i] == "G":
        Z.append(Y[i])
        cnt += 1
    elif cnt > 1:
        break
print(len(Z))

Submission status: Wrong Answer

Solution code:
a = ['A', 'C', 'G', 'T']
s = list(input())
result = 0
count = 0
for c in s:
    if c in a:
        count += 1
    else:
        if result < count:
            result = count
        count = 0
print(result)

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+1,n):
        subs = s[i:j]
        sset = set(s[i:j])
        if atcgset > sset:
            #print(s[i:j])
            if len(subs) > cnt:
                cnt = len(subs)
print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

n = len(S)
st = 0
ans = 0
for i in range(n):
    if S[i] in base:
        continue
    ans = max(ans, i - st)
    st += 1

print(ans)

Submission status: Wrong Answer

Solution code:
# 1文字ずつ格納
a = [str(i) for i in input()] 
max=0
ans=0

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

Submission status: Wrong Answer

Solution code:
def B():
    S = input()
    helyx_str = 'ATGC'
    cnt = 0
    max_cnt = 0
    for a in S:
        h = helyx_str.find(a) 
        if h != -1:
            cnt += 1
        else:
            if max_cnt < cnt:
               max_cnt = cnt
            cnt = 0

    print(max_cnt)
        

if __name__ == '__main__':
    B()

Submission status: Wrong Answer

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

lmax = 0
otpt = 0
for s in S:
  if s in l:
    lmax += 1
  else:    
    if lmax > otpt:
      otpt = lmax
    lmax = 0
      
print(otpt)

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)
elif(len(txt)==temp):
	print(temp)
else:
	print(big)

Submission status: Wrong Answer

Solution code:
S=input()
B=[]
ACGT=['A','C','G','T']
for s in S:
    if s in ACGT: B.append(True)
    else: B.append(False)
ans=0
for start in range(len(S)):
    if not B[start]: continue
    count=0
    for end in range(start,len(S)):
        if not B[end]:
            ans=max(ans,count)
            break
        count+=1
print(ans)

Submission status: Wrong Answer

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

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
        if i == len(S) - 1 and count == 0:
            count = tmp
    else:
        if count < tmp:
            count = tmp
            tmp = 0

print(str(count))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
answer = []
total = 0

for i in range(len(s)):
	if s[i] == "A" or s[i] == "G" or s[i] == "C" or s[i] == "T":
		answer.append("yes")
	else:
		answer.append("no")

for i in range(len(s)):
	if answer[i] == 'yes':
		if answer[i-1] == 'yes':
			total += 1

if total >= 1:
	total += 1
if total == 0:
	if 'yes' in answer:
		total += 1

print(total)

Submission status: Wrong Answer

Solution code:
list_original=input()
box=list(list_original)
MAX = 0
count = 0
flag = 0
for figure in box:
  if figure == 'A' or figure =='G' or figure =='C' or figure == 'G':
    flag = 1
  else:
    flag = 0
    count = 0
  if flag == 1:
    count += 1
  if count > MAX:
    MAX =count
print(MAX)

Submission status: Wrong Answer

Solution code:
b = input()

count = 0
max_count = 0
for s in b:
  if s == "A" or s == "C" or s == "G" or s == "T":
    count += 1
  else:
    if max_count < count:
      max_count = count
    count = 0
print(max_count)

Submission status: Wrong Answer

Solution code:
import re
S = input()

pattern = '[A|C|G|T]+'

# findall 
results = re.findall(pattern, S, re.S)

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

Submission status: Wrong Answer

Solution code:
s = input()
count = 0
tmp = 0
for b in s:
    if b == 'A' or b == 'T' or b == 'G' or b == 'C':
        tmp += 1
    else:
        count = max(count, tmp)
        tmp = 0
        continue
print(count)

Submission status: Wrong Answer

Solution code:
# 1文字ずつ格納
a = [str(i) for i in input()] 
max=0
ans=0

print(a)

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