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:
# -*- 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):
    
    m = 0
    for ss_length in range(len(s) + 1):
        for i in range(len(s)):
            if i+ss_length >= len(s):
                break

            ss = s[i:i+ss_length]
            count = 0
            for c in ss:
                if c in "ACGT":
                    count = count + 1
            if count == ss_length and m < ss_length:
                m = ss_length
                break


    return m

def main():
    # 出力

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

if __name__ == '__main__':

    main()

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):
    
    m = 0
    for ss_length in range(1, len(s)):
        for i in range(len(s)):
            if i+ss_length >= len(s):
                break

            ss = s[i:i+ss_length]
            count = 0
            for c in ss:
                if c in "ACGT":
                    count = count + 1
            if count == ss_length and m < ss_length:
                m = ss_length
                break


    return m

def main():
    # 出力

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

if __name__ == '__main__':

    main()

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 in range(len(s)):
        count = 0
        ss = s[i:]
        for j, c in enumerate(ss):
            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 -*-

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 in range(len(s)):
        ss = s[i:]
        for j, c in enumerate(ss):
            if c in "ACGT":
                count = count + 1
            else:
                if count > m:
                    m = count
                count = 0
        count = 0

    return m

def main():
    # 出力

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

if __name__ == '__main__':

    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X = ["A", "T", "C", "G"]
i = input()
max_cnt, cnt = 0, 0
for x in range(len(i)):
  if i[x] in X:
    cnt += 1
  else:
    if cnt > max_cnt:
      max_cnt = cnt
    cnt = 0
    
print(max_cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = list(input())
c,max = 0,0
for i in range(0,len(s)):
  if s[i] in "ATCG":
    c=1
    for j in range(i,len(s)-1):
      if s[j] in "ATCG":
        if j!=i:
          c+=1
      else:
        break
  if max < c:
    max=c      
print(max)

Submission status: Wrong Answer

Solution code:
s = list(input())
c,max = 0,0
for i in range(0,len(s)):
  if s[i] in "ATCG":
    c=1
    for j in range(i,len(s)-1):
      if s[j] in "ATCG":
        if c!=1:
          c+=1
      else:
        break
  if max < c:
    max=c      
print(max)

Submission status: Wrong Answer

Solution code:
s = list(input())
c,max = 0,0
for i in range(0,len(s)):
  if s[i] in "ATCG":
    c=0
    for j in range(i,len(s)-1):
      if s[j] in "ATCG":
        c+=1
        if max < c:
          max=c
      else:
        break
print(max)

Submission status: Wrong Answer

Solution code:
s = list(input())
c,max = 0,0
for i in range(0,len(s)):
  if s[i] in "ACGT":
    c=0
    for j in range(i,len(s)-1):
      if s[j] in "ACGT":
        c+=1
      else:
        if max < c:
          max=c
        break
print(max)

Submission status: Wrong Answer

Solution code:
s = list(input())
c,max = 0,0
for i in range(0,len(s)):
  if s[i] in "ATCD":
    c=0
    for j in range(i,len(s)-1):
      if s[j] in "ATCD":
        c+=1
      else:
        if max < c:
          max=c
        break
print(max)

Submission status: Wrong Answer

Solution code:
b = input()
c = b
n, m = 0, 0
for i in "ACGT":
    c = c.replace(i, "")
for j in c:
    n = max([len(k) for k in b.split(j)])
    if n > m:
        m = n
if c == "":
    print(len(b))
else:
    print(m)

Submission status: Wrong Answer

Solution code:
b = input()
c = b
n, m = 0, 0
for i in "ACGT":
    c = c.replace(i, "")
for i in c:
    n = max([len(i) for i in b.split(c)])
    if n > m:
        m = n
print(m)

Submission status: Wrong Answer

Solution code:
b = input()
c = b
n, m = 0, 0
for i in "ACGT":
    c += c.replace(i, "")
for i in c:
    n = max([len(i) for i in b.split(c)])
    if n > m:
        m = n
print(m)

Submission status: Wrong Answer

Solution code:
S = input()
dhlist = ["A","T","G","C"]
counter = 0
resultlist = [0]
for i in S:
    if i in dhlist:
        counter += 1
    else:
        resultlist.append(counter)
        counter = 0
print(max(resultlist))

Submission status: Wrong Answer

Solution code:
S = input()
T = ""

result = 0

while True:
	counter = 0
	for val in range(len(S)):
		if S[val] == "A":
			T = S[val:]	
			break
		elif S[val] == "C":
			T = S[val:]	
			break
		elif S[val] == "G":
			T = S[val:]	
			break
		elif S[val] == "T":
			T = S[val:]	
			break

	if val+1 == len(S):
		break

	for val in range(len(T)):
		if T[val] == "A":
			counter += 1
		elif T[val] == "C":
			counter += 1
		elif T[val] == "G":
			counter += 1
		elif T[val] == "T":
			counter += 1
		else:
			S = T[val:]
			break

	if result < counter:
		result = counter

	if val+1 == len(T):
		break

print(result)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

S = input()
T = ""
counter = 0
for val in range(len(S)):
	if S[val] == "A":
		T = S[val:]	
		break
	elif S[val] == "C":
		T = S[val:]	
		break
	elif S[val] == "G":
		T = S[val:]	
		break
	elif S[val] == "T":
		T = S[val:]	
		break

for val in range(len(T)):
	if T[val] == "A":
		counter += 1
	elif T[val] == "C":
		counter += 1
	elif T[val] == "G":
		counter += 1
	elif T[val] == "T":
		counter += 1
	else:
		break

print(counter)

Submission status: Wrong Answer

Solution code:
S = input()

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

Submission status: Wrong Answer

Solution code:
d = ["A","G","T","C"]
s = input()
r=[0]
n = 0
bf = 0
for t in s:
    if t in d:
        n += 1
        bf = 1
    else:
        if bf ==1:
            r.append(n)
            n = 0
        bf = 0
print(max(r))

Submission status: Wrong Answer

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







print(max(ans))

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/abc122/tasks/abc122_b

S = input().strip()

res = 0
count = 0
for c in S:
    if c in 'ACGT':
        count += 1
    else:
        res = max(res, count)
        count = 0

print(res)

Submission status: Wrong Answer

Solution code:
S = input()
carsol = 0
counter = 0
max_ = 0
for i in range(len(S)):
  if S[i] == "A" or S[i]== "G" or S[i]== "C" or S[i] == "T":
    counter += 1
  else:
    if max_ < counter:
      max_ = counter
    counter = 0
    
print(max_)

Submission status: Wrong Answer

Solution code:
import copy as c
S = list(input())
counter = 0
m_count = 0

for i in S:
    if (i=='A')or(i=='G')or(i=='C')or(i=='T'):
        counter += 1
    else:
        if m_count < counter:
            m_count = c.copy(counter)
        counter = 0
 

print(m_count)

Submission status: Wrong Answer

Solution code:
S = list(input())
counter = 0
m_count = 0

for i in S:
    if (i=='A')or(i=='G')or(i=='C')or(i=='T'):
        counter += 1
    else:
        if m_count < counter:
            m_count = counter
        counter = 0
 

print(m_count)

Submission status: Wrong Answer

Solution code:
import re

s = input()
l = re.findall('[ACGT]*', s)
print(len(max(l)))

Submission status: Wrong Answer

Solution code:
import re

s = input()
l = re.findall('[ACGT]*', s)
print(l)

Submission status: Wrong Answer

Solution code:
s = input()
wordList = 'ACGT'
t = []
tmp = []
lead = 0
ans = 0
slist = list(s)
for i in range(len(slist)):
    if not slist[i] in wordList:
        ans = max(ans, (i - lead))
        lead = i + 1
ans = max(ans, (i - lead))
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
wordList = 'ACGT'
lead = 0
ans = 0
slist = list(s)
for i in range(len(slist)):
    if not slist[i] in wordList:
        ans = max(ans, (i - lead))
        lead = i + 1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = input()
answer_list = []
answer = 0

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if __name__ == '__main__':
   main()

Submission status: Wrong Answer

Solution code:
s = input()

len_s = len(s)
ans = -1
tmp = ''
for i in range(len_s):
  if s[i] in 'ACGT':
    tmp += s[i]
  elif ans <= len(tmp):
    ans = len(tmp)
    tmp = ''
if ans == -1:
  ans = len_s
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()

ans = ''
tmp = ''
for i in range(len(s)):
  if s[i] in 'ACGT':
    tmp += s[i]
  elif len(ans) <= len(tmp):
    ans = tmp
    tmp = ''
print(len(ans))

Submission status: Wrong Answer

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

print(max)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
m = k = 0
for c in S:
  if c in 'ACGT':
    k += 1
  else:
    m = max(m, k)
    k = 0
print(m)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import re
import bisect
from datetime import datetime as dt

S = raw_input()
i = 0
max = 0
tmp = 0
while i < len(S):
    if S[i] in 'ACGT':
        tmp += 1
    else:
        if max < tmp:
            max = tmp
        tmp = 0
    i += 1
print max

Submission status: Wrong Answer

Solution code:
s = input()
s = s.translate(str.maketrans({'T': 'A', 'G': 'A', 'C': 'A'}))
print(s)
s = list(s)+['END']

if s[0] == 'A':
    counter = 1
else:
    counter = 0

ans = 0

for i in range(len(s)):
    if s[i - 1] == s[i] == 'A':
        counter += 1
    else:
        if ans < counter:
            ans = counter
        if s[i] == 'A':
            counter = 1
        else:
            counter = 0
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()

count =  0

for i in range(0,len(S)-1):
    if(S[i] == 'A'):
        count = count + 1
    elif(S[i] == 'T'):
        count = count + 1
    elif(S[i] == 'G'):
        count = count + 1
    elif (S[i] == 'C'):
        count = count + 1
print(count)

Submission status: Wrong Answer

Solution code:
S = input()

count =  0

for i in range(0,len(S)):
    if(S[i] == 'A'):
        count = count + 1
    elif(S[i] == 'T'):
        count = count + 1
    elif(S[i] == 'G'):
        count = count + 1
    elif (S[i] == 'C'):
        count = count + 1
print(count)

Submission status: Wrong Answer

Solution code:
S=input()

i=0
ans,temp=0,0
while(i<len(S)):
    if(S[i]=='A' or S[i]=='T' or S[i]=='G' or S[i]=='C'):
        temp+=1
        ans=max(ans,temp)
    i+=1

print(ans)

Submission status: Wrong Answer

Solution code:
text = input()
rule = 'ATCG'

max_len = 0
text_len = 0
for char in text:
    if char in rule:
        text_len += 1
    else:
        if text_len > max_len:
            max_len = text_len
        text_len = 0
print(max_len)

Submission status: Wrong Answer

Solution code:
s = list(input())
remove = ["A","T","C","G"]
mxm = 0
i = 0
counter = 0
while i < len(s):
    if s[i] in remove:
        counter += 1
        i += 1
    else:
        if counter > mxm:
            mxm = counter
        counter = 0
        i += 1
print(mxm)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in S:
    if i == "A" or i == "T" or i == "G" or i =="C":
        counter += 1
    else:
        if counter > ans:
            ans = counter
        counter = 0
        
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
count = 0

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

print(count)

Submission status: Wrong Answer

Solution code:
S = list(input())
temp = ""
list = []
ans = 0
for n in range(len(S)):
  if S[n]=="A" or S[n]=="C" or S[n]=="G" or S[n]=="T":
    temp += S[n]
  else:
    list.append(temp)
if len(list) == 0:
  list.append(temp)
temp = 0
for n in range(len(list)):
  if temp < len(list[n]):
    temp = len(list[n])
print(temp)

Submission status: Wrong Answer

Solution code:
S = list(input())
temp = ""
list = []
ans = 0
for n in range(len(S)):
  if S[n]=="A" or S[n]=="C" or S[n]=="G" or S[n]=="T":
    temp += S[n]
  else:
    list.append(temp)
temp = 0
for n in range(len(list)):
  if temp < len(list[n]):
    temp = len(list[n])
print(temp)

Submission status: Wrong Answer

Solution code:
s='AAABAAAAAA'
i=1
n=0
ans=[0]
sta=0
 
while i<=len(s):
  if s[i-1]=='A'or s[i-1]=='C' or s[i-1]=='G' or s[i-1]=='T':
    n=n+1
    sta=1
  elif sta==1:
    ans.append(n)
    n=0

  if i<=len(s):
    ans.append(n)
    
  i=i+1
  
print(max(ans))

Submission status: Wrong Answer

Solution code:
s=input()
i=1
n=0
ans=[0]
sta=0
 
while i<=len(s):
  if s[i-1]=='A'or s[i-1]=='C' or s[i-1]=='G' or s[i-1]=='T':
    n=n+1
    sta=1
  elif sta==1:
    ans.append(n)
    n=0

  if i<=len(s)|n==len(s):
    ans.append(n)
    
  i=i+1
  
print(max(ans))

Submission status: Wrong Answer

Solution code:
s=input()
i=1
n=0
ans=[0]
sta=0
 
while i<=len(s):
  if s[i-1]=='A'or s[i-1]=='C' or s[i-1]=='G' or s[i-1]=='T':
    n=n+1
    sta=1
  elif sta==1:
    ans.append(n)
    n=0
    
  i=i+1
  
  if i==len(s)|n==len(s):
    ans.append(n+1)
    n=0

print(max(ans))

Submission status: Wrong Answer

Solution code:
s=input()
i=1
n=0
ans=[0]
sta=0
 
while i<=len(s):
  if s[i-1]=='A'or s[i-1]=='C' or s[i-1]=='G' or s[i-1]=='T':
    n=n+1
    sta=1
  elif sta==1:
    ans.append(n)
    n=0
    
  i=i+1
  if i==len(s):
    ans.append(n)
    n=0

print(max(ans))

Submission status: Wrong Answer

Solution code:
s=input()
i=1
n=0
ans=[0]
sta=0
 
while i<=len(s):
  if s[i-1]=='A'or s[i-1]=='C' or s[i-1]=='G' or s[i-1]=='T':
    n=n+1
    sta=1
  elif sta==1:
    ans.append(n)
    n=0
    
  i=i+1

print(max(ans))

Submission status: Wrong Answer

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

c=0
ans=0
for word in S:
    c+=1 if word in acgt else 0
    ans = max(ans, c)
print(ans)

Submission status: Wrong Answer

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

c=0
ans=0
for word in S:
    if word in acgt:
        c+=1
    else:
        ans = max(ans, c)
        c=0

print(ans)

Submission status: Wrong Answer

Solution code:
s=input()
i=1
ans=''
sta=0
 
while i<=len(s):
  if s[i-1]=='A':
    ans=ans+s[i-1]
    sta=1
  elif s[i-1]=='T':
    ans=ans+s[i-1]
    sta=1
  elif s[i-1]=='C':
    ans=ans+s[i-1]
    sta=1
  elif s[i-1]=='G':
    ans=ans+s[i-1]
    sta=1
  elif sta==1:
    break
    
  i=i+1
print(len(ans))

Submission status: Wrong Answer

Solution code:
s=input()
i=1
ans=''
sta=0
 
while i<=len(s):
  if s[i-1]=='A':
    ans=ans+s[i-1]
    sta=1
  elif s[i-1]=='T':
    ans=ans+s[i-1]
    sta=1
  elif s[i-1]=='C':
    ans=ans+s[i-1]
    sta=1
  elif s[i-1]=='G':
    ans=ans+s[i-1]
    sta=1
  elif sta==1:
    break
    
  i=i+1
print(ans)

Submission status: Wrong Answer

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

for i in s:
    if i == 'A' or 'C' or 'G' or 'T':
        cnt += 1
        cmt2 = cnt
    else:
        cnt = 0

print(cnt2)

Submission status: Wrong Answer

Solution code:
S = input()
max_l = 0
temp_l = 0

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

print(max_l)

Submission status: Wrong Answer

Solution code:
S = input()
max_l = 0
temp_l = 0
for s in S:
    if s == 'A' or s=='G' or s=='C' or s=='T':
        temp_l += 1
    else:
        max_l = max(max_l, temp_l)
        temp_l = 0
print(max_l)

Submission status: Wrong Answer

Solution code:
text = input()



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


count = 0

endFlag = False

for i in range(len(text)):
    if text[i] in targets:
        for k in range(i, len(text)):
            if text[k] in targets:
                count += 1
            else:
                endFlag = True
                break
        endFlag = True
    if endFlag:
        break


print(count)

Submission status: Wrong Answer

Solution code:
text = input()



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


count = 0

for char in targets:
    index = text.find(char)
    if index != -1:
        for i in range(index, len(text)):
            if text[i] in targets:
                count += 1
            else:
                break
    break

print(count)

Submission status: Wrong Answer

Solution code:
s = input()
acgt = ['A', 'C', 'G', 'T']
lenn = 0
maxlen = 0
for i in range(len(s)):
  if (s[i] in acgt):
    lenn += 1
  else:
    if (maxlen <= lenn):
      maxlen = lenn
    lenn = 0
print(maxlen)

Submission status: Wrong Answer

Solution code:
ACGT = 'ACGT'
S = input().upper()
if len(S) <= 9 and len(S) != 0:
    for i in S:
        if i not in ACGT:
            S = S.replace(i, '-')
    LIST = S.split('-')
    LIST.sort(key = lambda n:len(n), reverse=True)
    print(len(LIST[0]))

Submission status: Wrong Answer

Solution code:
import re

S = input()
str_list = re.split(r'[^ATCG]', S)
print(len(max(str_list)))

Submission status: Wrong Answer

Solution code:
S = list(input())

AGCT = ['A','G','C','T']
Ans = [0]
for i in range(len(S)):
    for j in range(len(S)-i):
        if all(AGCT.count(c) == 1 for c in (S[i:-j])) == True:
            Ans.append(len(S[i:-j]))

print(max(Ans))

Submission status: Wrong Answer

Solution code:
S = list(input())

AGCT = ['A','G','C','T']
Ans = [0]
for i in range(len(S)):
    for j in range(len(S)-i):
        if all(AGCT.count(c) == 1 for c in (S[i:j+1])) == True:
            Ans.append(len(S[i:j+1]))
print(max(Ans))

Submission status: Wrong Answer

Solution code:
S = input()

ok_list = ["A", "C", "G", "T"]
ans_list = []
ans = 0

for c in S:
  if c in ok_list:
    ans += 1
  else:
    ans_list.append(ans)
    ans = 0

if ans_list:
  print(max(ans_list))
else:
  print(ans)

Submission status: Wrong Answer

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

import sys, re

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

S=input()
N=len(S)

ans=0
# 0文字以上でACGTのいずれかのみ
pattern = re.compile(r'^[ACGT]*$')
for i in range(N):
    for j in range(i+1, N):
        if pattern.match(S[i:j]):
            ans=max(ans, j-i)
print(ans)

Submission status: Wrong Answer

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

max_length_str = ''
tmp_str = ''
for n in string:
  if n in acgt:
    tmp_str += n
  else:
    if len(tmp_str) > len(max_length_str):
      max_length_str = tmp_str
      tmp_str = ''

print(len(max_length_str))

Submission status: Wrong Answer

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

max_length_str = ''
tmp_str = ''
for n in string:
  if n in acgt:
    tmp_str += n
  else:
    if len(tmp_str) > len(max_length_str):
      max_length_str = tmp_str
      tmp_str = ''

print(max_length_str)

Submission status: Wrong Answer

Solution code:
S=input()
max=0
l=0
for s in S:
  if (s=="A" or s=="T" or s=="C" or s=="G"):
    l+=1
  else:
    if max<l:
      max=l
    l=0
print(max)

Submission status: Wrong Answer

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

maxlen = 0
templen = 0
for i in range(len(S)):
    if S[i] in li:
        templen += 1
    else:
        maxlen = max(maxlen, templen)
        templen = 0
print(maxlen)

Submission status: Wrong Answer

Solution code:
import re
s = input()
s2 = re.split('[^ACGT]', s)
print(len(max(list(s2))))

Submission status: Wrong Answer

Solution code:
import re
s = input()
s2 = re.split('[^ACGT]', s)
print(len(max(s2)))

Submission status: Wrong Answer

Solution code:
S=list(input())
Check_list=['A','T','G','C']
 
out_num=0
for i in range(len(S)):
  for l in range(i,len(S)): 
    c=[x for x in S[i:l] if x not in Check_list]
    
    if (len(c) == 0) & (len(S[i:l]) >= out_num):
      out_num=len(S[i:l])
       
print(out_num)

Submission status: Wrong Answer

Solution code:
def function(S):
    ACGT = ['A', 'C', 'G', 'T']
    ret = 0
    N = len(S)
    for i in range(0, N):
        for j in range(i+1, N+1):
            temp = 0
            l = S[i:j]
            for x in l:
                if x not in ACGT:
                    break
            temp = len(l)
            if temp >= ret:
                ret = temp
    return ret

S = input()
print(function(S))

Submission status: Wrong Answer

Solution code:
def function(S):
    ACGT = ['A', 'C', 'G', 'T']
    ret = 0
    N = len(S)
    for i in range(0, N):
        for j in range(i+1, N+1):
            temp = 0
            l = S[i:j]
            for x in l:
                if x not in ACGT:
                    break
            temp = len(l)
        if temp >= ret:
            ret = temp
    return ret

S = input()
print(function(S))

Submission status: Wrong Answer

Solution code:
str = list(input())

tmp = ''
ans = ''
for s in str:
  if (s in ['A', 'T', 'G', 'C']):
    tmp += s
    if (len(tmp) > len(ans)):
      ans = tmp
  else:
    tmp = ''

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
ans = 0
possible = set(["A", "C", "G", "T"])

for i in range(len(s)-1, -1, -1):
  for j in range(len(s)):
    if j + i > len(s):
      break
    else:
      sub = s[j:i+j]
      if set(sub).issubset(possible):
        ans = max(ans, len(sub))

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
dic_ = str.maketrans({'T':'1','A':'1','C':'1','G':'1'})
s = s.translate(dic_)
count = 0
result = 0
pre_i = ''

for i in s:
  if pre_i == '1' and i == '1':
    count += 1
  elif pre_i =='1':
    if count > result:
      result = count
    count = 0
    pre_i = ''
  
  elif i == '1':
    count += 1
    pre_i = '1'
print(result)

Submission status: Wrong Answer

Solution code:
s = input()
dic_ = str.maketrans({'T':'1','A':'1','C':'1','G':'1'})
s = s.translate(dic_)
count = 0
result = 0
pre_i = ''
print(s)

for i in s:
  if pre_i == '1' and i == '1':
    count += 1
  elif pre_i =='1':
    if count > result:
      result = count
    count = 0
    pre_i = ''
  
  elif i == '1':
    count += 1
    pre_i = '1'
print(result)

Submission status: Wrong Answer

Solution code:
S = input()
max_l = 0
tmp = 0
for i in S:
  if i == 'A' or i == 'C' or i == 'G' or i == 'T':
    tmp += 1
  else:
    if max_l < tmp:
      max_l = tmp
    tmp = 0
print(max_l)

Submission status: Wrong Answer

Solution code:
s = input()
dic_ = str.maketrans({'T':'1','A':'1','C':'1','G':'1'})
s = s.translate(dic_)
count = 0
result = 0
pre_i = ''

for i in s:
  if pre_i == '1' and i == '1':
    count += 1
  elif pre_i =='1':
    if count > result:
      result = count
    else:
      count = 0
    pre_i = ''
  
  elif i == '1':
    count += 1
    pre_i = '1'
print(result)

Submission status: Wrong Answer

Solution code:
str = input()
ans = []
allow = ["A","C","G","T"]
count = 0
for s in str:
  if s in allow:
    count = count + 1
    
if len(ans) == 0:
  print(0)
else:
  print(sorted(ans)[-1])

Submission status: Wrong Answer

Solution code:
str = input()
ans = []
allow = ["A","C","G","T"]
count = 0
for s in str:
  if s in allow:
    count = count + 1
    
if len(ans) == 0:
  print(0)
else:
	print(sorted(ans)[-1])

Submission status: Wrong Answer

Solution code:
str = input()
ans = []
allow = ["A","C","G","T"]
count = 0
for s in str:
  if s in allow:
    count = count + 1
    ans.append(count)
  else:
    ans.append(0)
  
print(sorted(ans)[-1])

Submission status: Wrong Answer

Solution code:
S = input()
max_len = 0
temp = 0

for s in S:
	if (s == 'A') | (s == 'C') | (s == 'G') | (s == 'T'):
		temp += 1
	else:
		if temp >= max_len:
			max_len = temp
		temp = 0
print(max_len)

Submission status: Wrong Answer

Solution code:
moji = ['A', 'C', 'G', 'T']
#S = 'ATCODER'
S = 'HATAGAYA'
max_len = 0
temp = 0

for s in S:
    if (s == 'A') | (s == 'C') | (s == 'G') | (s == 'T'):
        temp += 1
    else:
        if temp >= max_len:
            max_len = temp
        temp = 0
print(max_len)

Submission status: Wrong Answer

Solution code:
s=input()
at='ACGT'
cnt=0
ans=[0]
for i in s:
    if i in at:
        cnt+=1
    else:
        ans+=[cnt]
        cnt=0
ans.sort()
print(ans[-1])

Submission status: Wrong Answer

Solution code:
s = input()
ans = 0
j = 0
for i in s:
    if i == 'A' or i == 'T' or i == 'G' or i == 'C':
        j += 1

    else:
        ans = max(ans, j)
        j = 0

print(ans)

Submission status: Wrong Answer

Solution code:
ml = 0
s = str(input())
acgt = ["A","C", "G", "T"]

def count_acgt(s, i):
    v = 0
    for t in range(i, len(s)):
        if s[t] in acgt:
            v += 1
    return v

for i, _ in enumerate(s):
    n = count_acgt(s, i)
    if n >= ml:
        ml = n

print(ml)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
data=input()
count=0
start=0
maxLen=0
for i in range(len(data)):
  if data[i] in "AGCT":
    if i>0:
      if data[i-1] not in "AGCT":
        start=i
    if i<len(data)-1:
      if data[i+1] not in "AGCT":
        length=i-start+1
        if length>maxLen:
          maxLen=length
print(maxLen)

Submission status: Wrong Answer

Solution code:
s = input()

atgc = 'ATGC'
count= 0
max_count = 0

for i in range(len(s)):
    if s[i] in atgc:
        print(s[i])
        count += 1
    else:
        if max_count < count:
            max_count = count
        count = 0
if max_count < count:
    max_count = count
print(max_count)

Submission status: Wrong Answer

Solution code:
s = input()

atgc = 'ATGC'
count= 0
max_count = 0

for i in range(len(s)):
    if s[i] in atgc:
        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
max = 0
for str in S:
  if str in {'A', 'C', 'G', 'T'}:
    cnt += 1
  else:
    if max < cnt:
      max = cnt
    cnt = 0
if max < cnt:
  max = cnt
print(cnt)