Problem:


Score : 200 points

Problem Statement

You are given a string S consisting of uppercase English letters. Find the length of the longest ACGT string that is a substring (see Notes) of S.

Here, a ACGT string is a string that contains no characters other than A, C, G and T.

Notes

A substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.

For example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and  (the empty string), but not AC.

Constraints

S is a string of length between 1 and 10 (inclusive).

Each character in S is an uppercase English letter.

Input

Input is given from Standard Input in the following format:

S

Output

Print the length of the longest ACGT string that is a substring of S.

Sample Input 1

ATCODER

Sample Output 1

3

Among the ACGT strings that are substrings of ATCODER, the longest one is ATC.

Sample Input 2

HATAGAYA

Sample Output 2

5

Among the ACGT strings that are substrings of HATAGAYA, the longest one is ATAGA.

Sample Input 3

SHINJUKU

Sample Output 3

0

Among the ACGT strings that are substrings of SHINJUKU, the longest one is  (the empty string).



Sample input:
ATCODER


Sample output:
3

Submission status: Wrong Answer

Solution code:
def li():
    return list(map(int, input().split()))


def mi():
    return map(int, input().split())


def ii():
    return int(input())


S = input()
ACGT = ["A", "C", "G", "T"]

length = 0
max_length = 0

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

print(max_length)

Submission status: Wrong Answer

Solution code:
def li():
    return list(map(int, input().split()))


def mi():
    return map(int, input().split())


def ii():
    return int(input())


S = input()
ACGT = ["A", "C", "G", "T"]

length = 0

for i in range(len(S)):
    if S[i] in ACGT:
        for j in range(i, len(S)):
            if S[j] not in ACGT:
                length = max(j - i, length)
                break

print(length)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def printlist(lst, k='\n'): print(k.join(list(map(str, lst))))
INF = float('inf')

def solve():
    S = list(input())

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


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
s = list(input())

tmp = 0
ans = 0

for i in range(len(s)):
    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
        tmp += 1
    else:
        if tmp > ans:
            ans = tmp
        tmp = 0

print(ans)

Submission status: Wrong Answer

Solution code:
import  re

ss = input()
ps = r"A|C|G|T"

seq = []
counter = 0
for s in ss:
    if re.match(ps, s):
        counter += 1
        seq.append(counter)
    else:
        counter = 0
seq.append(1)

print(max(seq))

Submission status: Wrong Answer

Solution code:
ss = input()
ps = "ACGT"

seq = []
counter = 0
for s in ss:
    if s in ps:
        counter += 1
        seq.append(counter)
    else:
        counter = 0
    
seq.append(1)
print(max(seq))

Submission status: Wrong Answer

Solution code:
s = input()

acgt = ['A', 'C', 'G', 'T']
count = 0
ans = 0

for i in range(len(s)):
    ans = max(ans, count)
    if s[i] in acgt:
        count += 1
    else:
        count = 0

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()

acgt = ['A', 'C', 'G', 'T']
count = 0
ans = 0

for i in range(len(s)):
    if s[i] in acgt:
        count += 1
    else:
        ans = max(ans, count)
        count = 0

print(ans)

Submission status: Wrong Answer

Solution code:
T = input()
word = ['A','C','G','T']
result = []
target_result = []
count = 0
for i in T:
  if i in word:
    result.append(i)
    count += 1
  else:
    if count == 0:
      continue
    target = ''.join(result)
    result = []
    target_result.append(target)
    count = 0
print(len(max(target_result)) if target_result else 0)

Submission status: Wrong Answer

Solution code:
T = input()
word = ['A','C','G','T']
result = []
target_result = []
count = 0
for i in T:
  if i in word:
    result.append(i)
    count += 1
  else:
    if count == 0:
      continue
    target = ''.join(result)
    reuslt = []
    target_result.append(target)
    count = 0
print(len(max(target_result)) if target_result else 0)

Submission status: Wrong Answer

Solution code:
ss = input()
dic = {'A':1, 'C':1, 'G':1, 'T':1}
max_s = 0
tmp = 0
for s in ss:
    try:
        tmp += dic[s]
    except:
        max_s = max(max_s,tmp)
        tmp = 0
        
print(max_s)

Submission status: Wrong Answer

Solution code:
ss = input()
dic = {'A':1, 'C':1, 'G':1, 'T':1}
max_s = 0
tmp = 0
for s in ss:
    if s in dic:
        tmp += 1
    else:
        max_s = max(max_s,tmp)
        tmp = 0
        
print(max_s)

Submission status: Wrong Answer

Solution code:
s = list(input())
m = 0
for i in range(len(s)):
    c = 0
    if s[i] == "A" or s[i] == "T" or s[i] == "G" or s[i] == "C":
        c += 1
        for j in range(1,len(s)-i):
            if s[i+j] == "A" or s[i+j] == "T" or s[i+j] == "G" or s[i+j] == "C":
                c += 1
            else:
                if c > m:
                    m = c
print(m)

Submission status: Wrong Answer

Solution code:
s = list(input())
m = 0
for i in range(len(s)):
    c = 0
    if s[i] == "A" or s[i] == "T" or s[i] == "G" or s[i] == "C":
        c += 1
        for j in range(1,len(s)-i-1):
            if s[i+j] == "A" or s[i+j] == "T" or s[i+j] == "G" or s[i+j] == "C":
                c += 1
            else:
                if c > m:
                    m = c
print(m)

Submission status: Wrong Answer

Solution code:
import re

S = input()

pattern = "[A|T|G|C]+"
match_result = re.findall(pattern, S)

ans = 0
for word in match_result:
    if ans <= len(word): ans = len(word)

Submission status: Wrong Answer

Solution code:
S = input()
result = 0
for i in range(len(S)):
    for j in range(1, len(S) - i):
        flg = True
        for c in tuple(S[i:i + j]):
            if not (c == 'A' or c == 'C' or c == 'G' or c == 'T'):
                flg = False
            if not flg:
                break
        if flg:
            if result < len(S[i:i + j]):
                result = len(S[i:i + j])
if result == 0 and (S[-1] == 'A' or S[-1] == 'C' or S[-1] == 'G' or S[-1] == 'T'):
    result = 1
print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S=lambda:input()
I=lambda:int(input())
L=lambda:list(map(int,input().split()))
LS=lambda:list(map(str,input().split()))

s=S()
ans=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:
        ans=max(ans,tmp)
        tmp=0
print(ans)

Submission status: Wrong Answer

Solution code:
s=input()
l=list("ACGT")
ans=0
for i in range(len(s)-1):
    for k in range(i+1,len(s)+1):
        if all(j in l for j in s[i:k+1]):
            ans=max(ans,len(s[i:k+1]))
print(ans)

Submission status: Wrong Answer

Solution code:
s=input()
l=list("ACGT")
ans=0
for i in range(len(s)-1):
    for k in range(i+1,len(s)):
        if all(j in l for j in s[i:k+1]):
            ans=max(ans,len(s[i:k+1]))
print(ans)

Submission status: Wrong Answer

Solution code:
s=input()+"O"
tmp=""
ans=[]
for i in s:
  if i in ["A","T","G","C"]:
    tmp=tmp+i
  else:
    ans.append(tmp)
    tmp=""
res=""
for i in ans:
  if len(i)>len(res):
    res=i
print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
S = input().strip()
popa = list("ACGT")
maxx = 0
counter = 0
for i in S:
  if i in popa:
    counter+=1
  else:
    maxx = max(maxx,counter)
maxx = max(maxx,counter)
print(maxx)

Submission status: Wrong Answer

Solution code:
S = input().strip()
popa = list("ACGT")
maxx = 0
counter = 0
for i in S:
  if i in popa:
    counter+=1
  else:
    maxx = max(maxx,counter)
print(maxx)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
count = 0

for i in S:
  if i == 'A' or i == 'T' or i == 'C' or i == 'G':
    count += 1
print("%d"%(count))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
"""
問題文
英大文字からなる文字列 S が与えられます。S の部分文字列 (注記を参照) であるような最も長い ACGT 文字列 の長さを求めてください。
ここで、ACGT 文字列とは A, C, G, T 以外の文字を含まない文字列です。
"""
import string
str_up = string.ascii_uppercase.replace("A","").replace("C","").replace("G","").replace("T","")
S = input()
part = []
for i in range(len(S)):
    for j in range(len(S)-i+1):
        part.append(S[i:i+j])
max_s = 0
print(part)
for i in part:
    for j in str_up:
        if j in i:
            break
        elif j == "Z":
            if len(i) > max_s:
                max_s = len(i)
print(max_s)

Submission status: Wrong Answer

Solution code:
import string
str_up = string.ascii_uppercase.replace("A","").replace("C","").replace("G","").replace("T","")
S = input()
part = []
for i in range(len(S)):
    for j in range(len(S)-i+1):
        part.append(S[i:i+j])
max_s = 0
print(part)
for i in part:
    for j in str_up:
        if j in i:
            break
        elif j == "Z":
            if len(i) > max_s:
                max_s = len(i)
print(max_s)

Submission status: Wrong Answer

Solution code:
import string
str_up = string.ascii_uppercase.replace("A","").replace("C","").replace("G","").replace("T","")
S = input()
part = []
for i in range(len(S)):
    for j in range(len(S)-i):
        part.append(S[i:j])
max_s = 0
for i in part:
    for j in str_up:
        if j in i:
            break
        elif j == "Z":
            if len(i) > max_s:
                max_s = len(i)
print(max_s)

Submission status: Wrong Answer

Solution code:
import string
str_up = string.ascii_uppercase.replace("A","").replace("C","").replace("G","").replace("T","")
S = input()
part = []
for i in range(len(S)):
    for j in range(len(S)-i):
        part.append(S[i:j])
max_s = 0
for i in part:
    for j in str_up:
        if j in i:
            break
        if j == "Z":
            if len(i) > max_s:
                max_s = len(i)
print(max_s)

Submission status: Wrong Answer

Solution code:
S=list(input())
line=[]
A=["A","C","G","T"]
num_list=[]
flag=False
for s in S:
    if s in A:
        line.append(s)
        flag=True
    elif flag:
        num_list.append(len(line))
        line=[]
        flag=False
if len(num_list)==0:print(0)
else:
    print(max(num_list))

Submission status: Wrong Answer

Solution code:
S=list(input())
line=[]
A=["A","C","G","T"]
flag=False
for s in S:
    if s in A:
        line.append(s)
        flag=True
    elif flag:break
print(len(line))

Submission status: Wrong Answer

Solution code:
S = str(input())
N = len(S)
AGCT = ["A", "G", "C", "T"]

ans = 0
for i in range(N + 1):
  for j in range(N + 1):
    if i <= j:
      x = 0
      for k in S[i : j]:
        if k in AGCT:
          x += 1
        else:
          ans = max(ans, x)  
      ans = max(ans, x)   
       
ans = max(ans, x)        
print(ans)

Submission status: Wrong Answer

Solution code:
S = str(input())
N = len(S)
AGCT = ["A", "G", "C", "T"]

ans = 0
for i in range(N + 1):
  for j in range(N + 1):
    if i <= j:
      x = 0
      for k in S[i : j]:
        if k in AGCT:
          x += 1
        else:
          ans = max(ans, x)
        
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
N = len(S)
l = []
for i in range(N):
  for j in range(i,N):
    s = S[i:j]
    if s.strip("A C G T") == "":
      l.append(s)

m = sorted(l, key=len)
print(len(m[-1]))

Submission status: Wrong Answer

Solution code:
S = input()
N = len(S)
l = []
for i in range(N):
  for j in range(i,N):
    s = S[i:j]
    if s.strip("A C G T") == "":
      l.append(s)

m = sorted(l, key=len)
print(m[-1])

Submission status: Wrong Answer

Solution code:
S = input()
N = len(S)
l = []
for i in range(N):
  for j in range(i,N):
    s = S[i:j]
    if s.strip("ACGT") == "":
      l.append(s)

m = sorted(l, key=len)
print(m[-1])

Submission status: Wrong Answer

Solution code:
S = str(input())
cnt = 0
l = [0]

for i in range(len(S)):
  if S[i] in 'ATGC':
    cnt += 1
  else:
    l.append(cnt)
    cnt = 0
print(max(l))

Submission status: Wrong Answer

Solution code:
S = input()

ans = 0
for i in range(len(S)):
    count = 0
    for s in S[i:]:
        if s in 'ACGT':
            count += 1
        else:
            ans = max(ans, count)
            break

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
word = ['A', 'C', 'G', 'T']
count = 0
tmp = 0

for i in s:
    if word.count(i) == 1:
        tmp += 1
    else:
        tmp = 0

    if count < tmp:
        count += tmp
print(count)

Submission status: Wrong Answer

Solution code:
s = input()
word = ['A', 'C', 'G', 'T']
count = 0
tmp = 0

for i in s:
    if word.count(i) == 1:
        tmp += 1
    else:
        count += tmp
        tmp = 0

print(count)

Submission status: Wrong Answer

Solution code:
# For taking integer inputs.
def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


S = instr()

n = len(S)

acgt = "ACGT"
max_len = 0
for i in range(n):
    for j in range(i+1, n):
        s = S[i:j]
        flag = 1
        for ch in s:
            if ch not in acgt:
                flag = 0
                break
        if flag == 1:
            max_len = max(max_len, len(s))
print(max_len)

Submission status: Wrong Answer

Solution code:
def ATCoder(s):
    lcount = 0
    lcan = 0
    for i in s:
        if i == 'A' or i == 'C' or i == 'G' or i == 'T':
            #print(i)
            lcount += 1
        else:
            if lcan < lcount:
                lcan = lcount
            lcount = 0
    #print(lcan)
    rcount = 0
    rcan = 0
    for i in reversed(s):
        if i == 'A' or i == 'C' or i == 'G' or i == 'T':
            #print(i)
            rcount += 1
        else:
            if rcan < rcount:
                rcan = rcount
            rcount = 0

    #print(rcan)

    if lcan > rcan:
        return lcan
    else:
        return rcan
if __name__ == "__main__":
    s = input()
    print(ATCoder(s))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
s = input()
max_length=0
length=0
for c in s:
    if c in 'AGCT':
        length+=1
    else:
        max_length=max(max_length, length)
        length=0
print(max_length)

Submission status: Wrong Answer

Solution code:
s = input()

c = []
x = ["A","G","C","T"]

for i in range(0,len(s)-1):
  if(s[i] in x):
    t = 1
    if(i == len(s)-2):
      #print(88)
      if(s[i+1] in x):
        c.append(2)
        break
      else:
        c.append(1)
        break
    for j in range(i+1,len(s)-1):
      if(s[j] in x):
        t = t + 1
      elif(s[j] not in x or j == len(s)):
        c.append(t)
if(len(c)==0):
  if(s[-1] in x):
    c.append(1)
  c.append(0)
print(max(c))

Submission status: Wrong Answer

Solution code:
s = input()

c = []
x = ["A","G","C","T"]

for i in range(0,len(s)-1):
  if(s[i] in x):
    t = 1
    if(i == len(s)-2):
      print(88)
      if(s[i+1] in x):
        c.append(2)
        break
      else:
        c.append(1)
        break
    for j in range(i+1,len(s)-1):
      if(s[j] in x):
        t = t + 1
      elif(s[j] not in x or j == len(s)):
        c.append(t)
if(len(c)==0):
  if(s[-1] in x):
    c.append(1)
  c.append(0)
print(max(c))

Submission status: Wrong Answer

Solution code:
s = input()

c = []
x = ["A","G","C","T"]


for i in range(0,len(s)-1):
  if(s[i] in x):
    t = 1
    for j in range(i+1,len(s)):
      if(s[j] in x):
        t = t + 1
      elif(s[j] not in x or j == len(s)):
        c.append(t)
if(len(c)==0):
  c.append(0)
print(max(c))

Submission status: Wrong Answer

Solution code:
import math
from collections import deque
from collections import defaultdict

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): # root
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): # much time
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): #j:aの個数
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq

s = readChar()

ans = -1

for i in range(len(s)):
	for j in range(i+1,len(s)):
		flg = 1
		for k in s[i:j]:
			if k not in ["A","C","G","T"]:
				flg = 0
				break
		if flg:
			#print("flg:",s[i:j])
			ans = max(ans,len(s[i:j]))

print(max(ans,0))

Submission status: Wrong Answer

Solution code:
import math
from collections import deque
from collections import defaultdict

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): # root
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): # much time
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): #j:aの個数
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq

s = readChar()

ans = -1

for i in range(len(s)):
	for j in range(i,len(s)):
		flg = 1
		for k in s[i:j]:
			if k not in ["A","C","G","T"]:
				flg = 0
				break
		if flg:
			ans = max(ans,len(s[i:j]))

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()

ans=0
for i in range(len(s)-1):
    ch=0
    for j in range(i,len(s)):
        if s[j] in 'ACGT':
            ch+=1
        else:
            ans=max(ans,ch)
            ch=0
    ans=max(ans,ch)
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()

ans=0
for i in range(len(s)-1):
    ch=0
    for j in range(i,len(s)):
        if s[j] in 'ACGT':
            ch+=1
        else:
            ans=max(ans,ch)
            ch=0
        ans=max(ans,ch)
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()

ans=0
for i in range(len(s)-1):
    ch=0
    for j in range(i,len(s)):
        if s[j] in 'ACGT':
            ch+=1
        else:
            ans=max(ans,ch)
            ch=0
print(ans)

Submission status: Wrong Answer

Solution code:
s = list(input())
n = len(s)
C = set()
C.add(0)
for i in range(n):
    if s[i] == "A" or s[i] == "T" or s[i] ==  "G" or s[i] ==  "C":
        c = 1
        for j in range(i+1,n):
            if s[j] == "A" or s[j] == "T" or s[j] == "G" or s[j] == "C":
                c += 1
            else:
                C.add(c)

print(max(C))

Submission status: Wrong Answer

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

count=0
v=0
for i in range(len(S)):
  if S[i] in DNA:
    count+=1
  else:
    if v < count:
      v=count
      count=0
    else:
      count=0

print(v)

Submission status: Wrong Answer

Solution code:
s = input()
ans1 = 0
ans2 = 0

for a in s:
  if a == "A" or a == "T" or a == "C" or a == "G":
    ans2 += 1
  else:
    if ans1 < ans2:
      ans1 = ans2
      ans2 = 0
    else:
      ans2 = 0
print(ans1)

Submission status: Wrong Answer

Solution code:
s = input()
ans = 0
lis = []

for a in s:
  if a == "A" or a == "T" or a == "C" or a == "G":
    ans += 1
  else:
    lis.append(ans)
    ans = 0

print(lis)

Submission status: Wrong Answer

Solution code:
S = list(input())
maxIndex = len(S)

result = 0
for index in range(len(S)):
    counter = 0
    for tmp in range(index, maxIndex):
        if S[tmp] in ["A", "C", "G", "T"]:
            counter += 1
            if tmp + 1 == maxIndex:
                if counter > result:
                    result = counter
                    break
            continue
        if counter > result:
            result = counter
            break
    if result == maxIndex: break

print(result)

Submission status: Wrong Answer

Solution code:
S = list(input())
maxIndex = len(S)

result = 0
for index in range(len(S)):
    counter = 0
    for tmp in range(index, maxIndex):
        if S[tmp] in ["A", "C", "G", "T"]:
            counter += 1
            if tmp == maxIndex:
                if counter > result:
                    result = counter
                    break
            continue
        if counter > result:
            result = counter
            break
    if result == maxIndex: break

print(result)

Submission status: Wrong Answer

Solution code:
s = input()
t = "ACGT"

ans = 0
cnt = 0
for ss in s:
    if ss in t:
        cnt += 1
    else:
        ans = max(cnt, ans)
        cnt = 0
print(ans)

Submission status: Wrong Answer

Solution code:
import re
s=input()
ans=re.findall(r"((A|T|G|C)+)",s)#先に(が手てくる方から行列が形成される。

if ans==[]:#リストではなくてタプルなので注意・
    print(0)
else:
    #max関数はnumpyでないと一次元に特化していてなかなか思い通りに動かないので
    max=0
    for i in range(len(ans)):
        temp=ans[i][0]
        if len(temp) >= max:
            max=len(temp)
print(max)

Submission status: Wrong Answer

Solution code:
import re
s=input()
ans=re.findall(r"((A|T|G|C)+)",s)#先に(が手てくる方から行列が形成される。
print(ans)
if ans==[]:#リストではなくてタプルなので注意・
    print(0)
else:
    print(ans)#max関数はnumpyでないと一次元に特化していてなかなか思い通りに動かないので
    max=0
    for i in range(len(ans)):
        temp=ans[i][0]
        if len(temp) >= max:
            max=len(temp)
print(max)

Submission status: Wrong Answer

Solution code:
import re
s=input()
ans=re.findall(r"((A|T|G|C)+)",s)#先に(が手てくる方から行列が形成される。
if ans==[]:#リストではなくてタプルなので注意・
    print(0)
else:
    print(len(max(ans[0],key=len)))

Submission status: Wrong Answer

Solution code:
s=input()
import re
ans=re.findall("[A,T,G,C]+",s)#findall、なかったら[]が帰ってくる。matchのようにNoneが帰ってくるわけではない。
if ans==[]:
    print(0) 
else:
    print(len(ans[0]))

Submission status: Wrong Answer

Solution code:
S = input()
maxlen=count=0
isT = False
for i in range(len(S)):
  if S[i] == "T":
    isT = True
  if S[i] == "T" or S[i] == "G" or S[i] == "C" or S[i] == "A":
    count += 1
  else:
    if isT and maxlen < count:
      maxlen = count
    count = 0
    isT = False
print(maxlen)

Submission status: Wrong Answer

Solution code:
S = input()
length = 0
count = 0

for i in range(len(S)):
    for char in S[:i]:
        if char in "AGCT":
            count += 1
        else:
            length = max(length, count)
            count = 0
    count = 0

print(length)

Submission status: Wrong Answer

Solution code:
s=input()
import re
ans=re.search("(A|T|G|C)+",s)#matchは文字列先頭のみ、searchは文字列中の位置にかかわらずマッチ。
if ans==None:#noneでエラーが出かねないので事前に排除しておく。
    print(0)
else:
    print(len(ans.group(0)))#何も指定しなければ貪欲マッチで一番長くなるはず。

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
n = len(s)
ans=0
for i in range(n):
  for j in range(n-i):
    if all('ACGT'.count(c) == 1 for c in s[i:j+1]):
      ans = max(ans, j-i+1)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
N = len(S)
a,b = 0,0
l = [0]

for i in range(N):
  if S[i] == 'A' or S[i] == 'C' or S[i] == 'G' or S[i] == 'T':
    a += 1
    b = 1
  else:
    if b:
      l.append(a)
      b = 0
      a = 0
else:
  print(max(l))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
import numpy as np
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = input()

tmp = []
tmp.append(-1)
for i, x in enumerate(S):
	if x != "A" and x != "T" and x != "G" and x != "C":
		tmp.append(i)
tmp.append(len(S))
print(tmp)

tmp2 = [tmp[i+1] - tmp[i] for i in range(len(tmp)-1)]
print(max(tmp2)-1)

Submission status: Wrong Answer

Solution code:
s = input()
acgt = ["A","C","G","T"]
ans = 0
for i in range(len(s)):
	for l in range(1,len(s)):
		t = s[i:l].replace("A","").replace("C","").replace("G","").replace("T","")
		if len(t) == 0:
 			if len(s[i:l]) > ans:
	  			ans = len(s[i:l])
		
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()

MAX = 0
m = 0
for i in s:
  print(m)
  if i == "A" or i == "G" or i == "C" or i == "T":
    m += 1
    MAX = max(MAX,m)
  else:
    m = 0

Submission status: Wrong Answer

Solution code:
s = input()

MAX = 0
m = 0
for i in s:
  if i == "A" or i == "G" or i == "C" or i == "T":
    m += 1
  else:
    MAX = max(MAX,m)
    m = 0
print(MAX)