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


def length(s, i, j):
    for c in s[i:j]:
        if c not in 'ACGT ':
            return 0
    return len(s[i:j])


for i in range(len(s)):
    for j in range(len(s)):
        candidate = max(candidate, length(s, i, j))

print(candidate)

Submission status: Wrong Answer

Solution code:
s = input()
max_count = 0
count = 0
acgt = ['A', 'C', 'G', 'T']
for c in s :
    if c in acgt :
        count += 1
    else :
        if count != 0 and max_count < count :
            max_count = count
        count = 0
print(max_count)

Submission status: Wrong Answer

Solution code:
s = input()
s2 = ""
list_ = []
sn = 0
i = len(s)
for i in range(0,i):
 if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
  s2 += s[i]
 else:
  if not s2 == "":
   list_.append(s2)
   s2 = ""
if len(list_) != 0:
 for i in range(0, len(list_)):
  if len(list_[i]) > sn:
   sn = len(list_[i])
  # print(len(list_[i]),sn)
 print(sn)
else:
 print(0)

Submission status: Wrong Answer

Solution code:
s = input()
s2 = ""
list_ = []
i = len(s)
for i in range(0,i):
 if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
  s2 += s[i]
 else:
  if not s2 == "":
   list_.append(s2)
   s2 = ""
if len(list_) != 0:
 print(len(max(list_)))
else:
 print(0)

Submission status: Wrong Answer

Solution code:
s = input()
s2 = ""
list_ = []
i = len(s)
for i in range(0,i):
 if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
  s2 += s[i]
 else:
  if not s2 == "":
   list_.append(s2)
   s2 = ""
if len(list_) != 0:
 print(len(max(list_)))
else:
 print(0)

Submission status: Wrong Answer

Solution code:
s = input()
s2 = ""
list_ = []
sn = 0
i = len(s)
for i in range(0,i):
 if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
  s2 += s[i]
 else:
  if not s2 == "":
   list_.append(s2)
if len(list_) != 0:
 print(len(max(list_)))
else:
 print(0)

Submission status: Wrong Answer

Solution code:
s = input()
s2 = ""
list_ = []
sn = 0
i = len(s)
for i in range(0,i):
 if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
  s2 += s[i]
 else:
  if not s2 == "":
   list_.append(s2)
if len(list_) != 0:
 print(len(max(list_)))
else:
 print("0")

Submission status: Wrong Answer

Solution code:
st = str(input())

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

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()

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

Submission status: Wrong Answer

Solution code:
S = input()
S1 = len(S)
S3 = 0
S4 = 0
while S1 != 0:
    S2 = S[0:1]
    S1 = S1 - 1
    S = S[1:]
    if S2 == "A" or S2 == "C" or S2 == "G" or S2 == "T":
        S3 = S3 + 1
    else:
        if S3 > S4:
            S4 = S3
            S3 = 0
print(str(S4))

Submission status: Wrong Answer

Solution code:
S = list(input())

num = 0
num_list = [0]
for i in S:
    if i == "A" or i == "T" or i == "G" or i == "C":
        num += 1
    else:
        num_list.append(num)
        num = 0
print(max(num_list))

Submission status: Wrong Answer

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

print(A+T+G+C)

Submission status: Wrong Answer

Solution code:
s=input()
ans=1
leng=len(s)-1

for i in range(leng):
    if s[i] in {'A','T','C','G'}:
        if s[i+1] in {'A','T','C','G'}:
            ans+=1

print(ans)

Submission status: Wrong Answer

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

a = input()

l = ["A","T","G","C"]
count  = 0
max = 0
for i in range(len(a)):
    for j in range(i,len(a)):
        if(a[j] not in l):
            if(max < count):
                max = count
            count = 0
            break;
        else:
            count += 1

print(max)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python

import re

def main():
    s = str(input())
    print(len(max([x for x in (re.split('[^ACGT]+', s))])))


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python

import re

def main():
    s = str(input())
    print(max([x for x in (re.split('[^ACGT]+', s))]))


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import re


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

Submission status: Wrong Answer

Solution code:
genom=input()
maxstr=0
bush=0

for i in range(len(genom)):
    if genom[i]=="A" or genom[i]=="G" or genom[i]=="T" or genom[i]=="C":
        bush = bush+1
    else:
        if bush>maxstr:
            maxstr=bush
        bush=0

print(maxstr)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def is_acgt(c):
    return c == 'A' or c == 'C' or c == 'G' or c == 'T'

s = input()
n = len(s)
t = [1 if is_acgt(s[i]) else 0 for i in range(n)]

max = 0
current = 0
for i in range(n):
    if t[i] == 0:
        if current > max:
            max = current
        current = 0
        continue
    current += 1

print(max)

Submission status: Wrong Answer

Solution code:
S = input()

ans = 0
ans_tmp = 0

x = {'A', 'G', 'C', 'T'}

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

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()

ans = list()
ans_tmp = list()

x = {'A', 'G', 'C', 'T'}

for s in S:
  if s in x:
    ans_tmp.append(s)
  else:
    if len(ans_tmp) > len(ans):
      ans = ans_tmp.copy()
    ans_tmp = list()

print(len(ans))

Submission status: Wrong Answer

Solution code:
S = input()

ans = list()
ans_tmp = list()

x = {'A', 'G', 'C', 'T'}

for s in S:
  if s in x:
    ans_tmp.append(s)
  else:
    if len(ans_tmp) > len(ans):
      ans = ans_tmp.copy()
      ans_tmp = list()

print(len(ans))

Submission status: Wrong Answer

Solution code:
S = input()

ans = list()
ans_tmp = list()

x = {'A', 'G', 'C', 'T'}

for s in S:
  if s in x:
    ans_tmp.append(s)
  else:
    if len(ans_tmp) > len(ans):
      ans = ans_tmp
      ans_tmp = list()

print(len(ans))

Submission status: Wrong Answer

Solution code:
s = input()
l=["A","T","C","G"]

max_cnt = 0
cnt = 0
for _s in s:
    if _s in l:
        cnt+=1
    else:
        if max_cnt < cnt:
            max_cnt=cnt
            cnt=0

print(max_cnt)

Submission status: Wrong Answer

Solution code:
S=input()
n=len(S)
i=0
count=0
maxcount=0
while(n>0):
    if(S[i]=='A'or S[i]=='T' or S[i]=='G' or S[i]=='C'):
        count=count+1
    else:
        if(maxcount<count):
            maxcount=count
        count=0
    n=n-1
    i=i+1
print(maxcount)

Submission status: Wrong Answer

Solution code:
S = input()
T = len(S)
if T >= 1 and T <=10 :
    if S.isupper() :
        ta = S.count("A")
        ti = S.count("T")
        tu = S.count("C")
        te = S.count("G")
        print(ta + ti + tu + te)

Submission status: Wrong Answer

Solution code:
S = input()

count = [0 for i in range(len(S))]

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

idx = 0
for i in S:
    if i in atgc:
        count[idx] = 1
    idx += 1

list_ct = []
ct = 0
for i in count:
    if i == 1:
        ct += 1
    else:
        if ct > 0:
            list_ct.append(ct)
            ct = 0

if list_ct:
    print(max(list_ct))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
S = input()
T = len(S)
if T >= 1 and T <=10 :
    ta = S.count("A")
    ti = S.count("T")
    tu = S.count("C")
    te = S.count("G")
    print(ta + ti + tu + te)

Submission status: Wrong Answer

Solution code:
L = list(input())
count, max_ = 0, 0
for i in L:
  if i == 'A' or i == 'T' or i == 'C' or i == 'G':
    count += 1
  else:
    if count > max_:
      max_ = count
    count = 0
print(max_)

Submission status: Wrong Answer

Solution code:
S = input()

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
S=input()
buf=0
count=0
for c in S:
  if c=="A" or c=="T"or c=="G"or c=="C":
    count+=1
  else:
    if buf<count:
      buf=count
      count=0
print(buf)

Submission status: Wrong Answer

Solution code:
ACGT=["A","C","G","T"]
s=list(input())
s.append("0")
i=0
ans=[0]
length=0
while s[i] != "0":
  if s[i] in ACGT:
    length += 1
    i += 1
  else:
    ans.append(int(length))
    length = 0
    i += 1

print(max(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S =list(input())

ans = [0]
n = 0

for x in S:
    if x in {'A','T','C','G'}:
        n += 1
    else:
        ans.append(n)
        n = 0

print(max(ans))

Submission status: Wrong Answer

Solution code:
S = input()
 
ACGT = ["A","C","T","G"]
ctr = 0
ctrs = [0]
for c in S:
  if c in ACGT:
    ctr += 1
  else:
    ctrs.append(ctr)
    ctr = 0
 
print(max(ctrs))

Submission status: Wrong Answer

Solution code:
T = list(map(str,input()))
print(T)

count = 0
flag1 = 0
list_count = []
for i in T:
    if i == 'A' or i == 'T' or i == 'G' or i == 'C':
        flag1 = 1
        count = count +1
    elif flag1 ==1:
        list_count.append(count)
        flag = 0
        count = 0
list_count.append(count)
print(max(list_count))

Submission status: Wrong Answer

Solution code:
S = list(input())
max_len = 0
for i in range(len(S)):
    for j in range(len(S)-i):
        bubun = S[i:j+1]
        is_acgt = [s in ("T","A","G","C") for s in bubun]
        if all(is_acgt) and len(bubun)>max_len:
            max_len = len(bubun)
print(max_len)

Submission status: Wrong Answer

Solution code:
S = list(input())
max_len = 0
for i in range(len(S)):
    for j in range(len(S)-i):
        if all(s in ("T","A","G","C") for s in S[i:j]) and len(S[i:j])>max_len:
            max_len = len(S[i:j])
print(max_len)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

def main():
    S = input()
    i = 0
    max_length = 0
    for c in S:
        if c in ['A', 'T', 'G', 'C']:
            i += 1
        else:
            if max_length < i:
                max_length = i
            i = 0
    print(max_length)



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
base_dict = {"A": "T", "T": "A", "G": "C", "C": "G"}

S = input()

max_count = 0
current_count = 0
for c in S:
    if c in base_dict:
        current_count += 1
    else:
        if max_count < current_count:
            max_count = current_count
        current_count = 0

print(max_count)

Submission status: Wrong Answer

Solution code:
S = input()
tmp = []
for i in range(len(S)):
    j = 0
    while i + j < len(S):
        if S[i + j] in ['A', 'C', 'G', 'T']:
            j += 1
        else:
            if j != 0:
                tmp.append(S[i : i + j])
            break
tmp = list(map(lambda x : len(x), tmp))
if list(set(tmp)) == []:
    print(0)
else:
    print(max(tmp))

Submission status: Wrong Answer

Solution code:
s = input()
ans = 0
tmp = 0
for c in s:
    if c in 'ACGT':
        tmp += 1
    else:
        ans = max(ans, tmp)
        tmp = 0
print(ans)

Submission status: Wrong Answer

Solution code:
ACGT = input()

result = 0
tmp = 0
for c in ACGT:
  if c in 'ACGT':
    tmp += 1
  else:
    result = max(result, tmp)
    tmp = 0

print(result)

Submission status: Wrong Answer

Solution code:
s = input()

maxx = 0
count = 0
data = ["A","C","T","G"]
for i in range(len(s)): # i == 先頭の文字
    for j in range(i,len(s)): # j == 動かす文字
        if s[j] in data:
            count += 1
    if maxx < count :
        maxx = count
    count = 0

print(maxx)

Submission status: Wrong Answer

Solution code:
ACGT = input()

max = 0
tmp = 0
for c in ACGT:
  if c in 'ACGT':
    tmp += 1
  else:
    if tmp > max:
      max = tmp
      tmp = 0

print(max)

Submission status: Wrong Answer

Solution code:
ans = count = 0
for c in input():
    if c in "ACGT":
        count += 1
    else:
        ans = max(ans, count)
        count = 0
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input() + 'E'
for w in list('ACGT'):
    S = S.replace(w, ' ')
count = 0
max_count = 0
for w in S:
    if w == ' ':
        count += 1
    elif count > max_count:
        max_count = count
print(max_count)

Submission status: Wrong Answer

Solution code:
S = list(input())
N = len(S)
H = list('ATGC')
m = 0
for i in range(N):
    if S[i] in H:
        m += 1
print(m)

Submission status: Wrong Answer

Solution code:
S = input()
N = len(S)
n_max = 0
for n in range(N):
    for m in range(n, N):
        s = S[n:m]
        if all("ATCG".count(ss) for ss in s):
            n_max = max(n_max, len(s))
print(n_max)

Submission status: Wrong Answer

Solution code:
S = input()
Sc = S.replace("A","").replace("T","").replace("G","").replace("C","")
print(len(S)-len(Sc))

Submission status: Wrong Answer

Solution code:
try:
	S = list(input())
except EOFError:
	print(0)
else:
	max = 0
	cnt = 0
	for str in S:
		if str in {"A", "C", "G", "T"}:
			cnt = cnt + 1
		else:
			if cnt > max:
				max = cnt
			cnt = 0

	print(max)

Submission status: Wrong Answer

Solution code:
S = input()
def ACGT(S):
    for d in S:
        if not d in "AGCT":
            return False
    return True
def solve(S):
    res = 0
    for i in range(len(S)):
        for j in range(i,len(S)):
            if (ACGT(S[i:j])):
                res = max(j-i,res)
    return res
print(solve(S))

Submission status: Wrong Answer

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

count_max = count

print(count_max)

Submission status: Wrong Answer

Solution code:
s = str(input())
#s = 'ATCODER'

s = s.replace('Z','B')
for i in ['A','T','G','C']:
    s = s.replace(i,'Z')

count = 0
count_max = 0
for i in s:
    if i == 'Z':
        count += 1
    else:
        if count_max < count:
            count_max = count
            count = 0

print(count_max)

Submission status: Wrong Answer

Solution code:
s = str(input())

for i in ['A','T','G','C']:
    s = s.replace(i,'-')

count = 0
count_max = 0
for i in s:
    if i == '-':
        count += 1
    else:
        if count_max < count:
            count_max = count
            count = 0

print(count_max)

Submission status: Wrong Answer

Solution code:
S = input()
N = len(S)
atcg_lst = []
for n in range(N):
    for m in range(n, N):
        s = S[n:m]
        atcg = [ss for ss in s if ss in "ATCG"]
        atcg_lst.append(len(atcg))
print(max(atcg_lst))

Submission status: Wrong Answer

Solution code:
max_len = 0
T = ""
for s in input():
    if s in "ATCG":
        T += s
    else:
        if max_len < len(T):
            max_len = len(T)
        T = ""
print(max_len)

Submission status: Wrong Answer

Solution code:
print(len([s for s in input() if s in "ATCG"]))

Submission status: Wrong Answer

Solution code:
str = input()
maxans = []
ans = []

for j in range(0,len(str)):
  for i in range(j,len(str)):
    print(str[i])
    if str[i] == 'A' or str[i] == 'C' or str[i] == 'G' or str[i] == 'T':
      ans.append(str[i])
    else:
      break
  if len(ans) >= len(maxans):
    maxans = ans
  ans = []
      
print(maxans)
print(len(maxans))

Submission status: Wrong Answer

Solution code:
S = input()
ACGT = [ 'A', 'C', 'G', 'T']
sum = 0
for i in ACGT:
  sum += S.count(i)
print(sum)

Submission status: Wrong Answer

Solution code:
S = input()
ACGT = [ 'A', 'C', 'G', 'T']
sum = 0
for i in ACGT:
  sum = S.count(i)
print(sum)

Submission status: Wrong Answer

Solution code:
b = input()
bls = []

for x in range(0,len(b)):
    bls.append(b[x])

def ACGT(b):
    if b == "A" or b =="C" or b =="G" or b =="T":
        return True
    else:
        return False


now = 0
maxx = 0

for x in bls:
    if ACGT(x):
        now += 1
    elif now >= maxx:
        maxx = now
        now = 0
    else:
        now = 0

print(maxx)

Submission status: Wrong Answer

Solution code:
b = input()
bls = []

for x in range(0,len(b)):
    bls.append(b[x])

def ACGT(b):
    if b == "A" or b =="C" or b =="G" or b =="T":
        return True
    else:
        return False


now = 0
maxx = 0

for x in bls:
    if ACGT(x):
        now += 1
    elif now > maxx:
        maxx = now
        now = 0
    else:
        now = 0

print(maxx)

Submission status: Wrong Answer

Solution code:
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in sys.stdin.readline().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def bisearch(L, target):
    low = 0
    high = len(L) - 1
    
    while low <= high:
        mid = (low + high) // 2
        guess = L[mid]
        if guess == target:
            return True
        elif guess < target:
            low = mid + 1
        elif guess > target:
            high = mid - 1
    if guess != target:
        return False

# --------------------------------------------

dp = None


def main():
    S = input()

    ans = -1

    c = 0

    for s in S:
        if s in "ATCG":
            c += 1
            ans = max(ans, c)
        else:
            c = 0

    print(ans)


main()

Submission status: Wrong Answer

Solution code:
S = list(input())
max = 0
cnt = 0
for str in S:
	if str in {"A", "C", "G", "T"}:
		cnt = cnt + 1
	else:
		if cnt > max:
			max = cnt
		cnt = 0

print(max)

Submission status: Wrong Answer

Solution code:
def main():
    s = input()

    ans = 0
    for i in range(len(s)):
        cur = 0
        for j in range(i,len(s)):
            if s[j] in {"A", "C", "G", "T"}:
                cur += 1
            else:
                break

            ans = max(cur, ans)


    print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
judgeList = ['A', 'C', 'G', 'T']
maxLength = 0
currentLength = 0
for i, v in enumerate(S):
    if v in judgeList:
        currentLength += 1
    else:
        maxLength = max(currentLength, maxLength)
        currentLength = 0
print(maxLength)

Submission status: Wrong Answer

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

for a in S:
  if  a in T:
    count = count + 1
  else:
    maxcount = max(count,maxcount)
    count = 0

print(maxcount)

Submission status: Wrong Answer

Solution code:
S = input()
     
if 'ACGT' in S:
  len('ACGT')

Submission status: Wrong Answer

Solution code:
s = input()
t = ''
for i in range(len(s)):
    if s[i] in ('A', 'C', 'G', 'T'):
        t += '1'
    else:
        t += '0'
print(t)
print(t.split('0'))
print(max(map(len, t.split('0'))))

Submission status: Wrong Answer

Solution code:
S = input()
l = len(S)
x = 0
for i in range(l - 1):
    j = i + x + 1
    while(j < l):
        k = i
        flag = True
        while(k < j):
            if S[k] not in ['A', 'C', 'G', 'T']:
                flag = False
                break
            else:
                k += 1
        if flag:
            x = j - i
        j += 1
print(x)

Submission status: Wrong Answer

Solution code:
S = input()
i = ["A","G","C","T"]
list_S = [S]
ch = 0
an = 0
for j in S :
  if j in i :
    ch += 1
  else :
    an = max(an, ch)
    ch = 0
print(an)

Submission status: Wrong Answer

Solution code:
S = input()
list_S = [S]
ch = 0
an = 0
for i in S :
  if i in list_S:
    ch += 1
  else :
    an = max(an, ch)
    ch = 0
print(an)

Submission status: Wrong Answer

Solution code:
S = input()

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

Submission status: Wrong Answer

Solution code:
s = input()
k = ['A', 'G', 'C', 'T']
i = 0

while i < len(s):
    if s[i] in k:
        pass
    else:
        s_changed = s[:i] + 'z' + s[i + 1:]
        s = s_changed
    i += 1

s_split = s.split('z')
ans = len(max(s_split))
print(ans)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
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

print(ans)

Submission status: Wrong Answer

Solution code:
# coding:utf-8

def main():
    s = input()
    ans = 0
    for i in range(len(s)):
        for j in range(i,len(s)):
            temp = s[i:j]
            if atgc_check(temp) and len(temp) > ans:
                ans = len(temp)
    print(ans)

def atgc_check(sub_s):
    for si in sub_s:
        if not si in ["A","T","G","C"]:
            return False
    return True

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# coding:utf-8

def main():
    s = input()
    ans = 0
    for i in range(len(s)):
        for j in range(len(s)):
            temp = s[i:j]
            if atgc_check(temp) and len(temp) > ans:
                ans = len(temp)
    print(ans)

def atgc_check(sub_s):
    for si in sub_s:
        if not si in ["A","T","G","C"]:
            return False
    return True

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(maxcount)

Submission status: Wrong Answer

Solution code:
S = input()
acgt=["A", "C", "G", "T"]
count = 0
max_count = 0

for i in S:
    if i in acgt:
        count += 1
    else:
        if count > max_count:
            max_count = count
        count = 0

print(max_count)

Submission status: Wrong Answer

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

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

maxC = 0
count = 0

for c in S:
    if c in "ACTG":
        count += 1
    else:
        if maxC < count:
            maxC = count
        count = 0

print(maxC)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def atcoder(string):
    acgt = set('ACGT')                                               
    on_count = False                                                 
    count = 0 
    max_count = 0                                                    
    
    for c in string:
        if c in acgt:
            if not on_count:
                on_count = True                                      
            count += 1                                               
        else:
            if on_count:
                on_count = False
                max_count = max(max_count, count)
                count = 0 
                
    return max_count
    
                                                                     
if __name__ == "__main__":
    string = input()
    print(atcoder(string))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = str(input())
m = 0
i = 0
while True:
  if (i == len(S)-1):
      break
  n = 0
  while True:
    if not((S[i] == "A")or(S[i] == "C")or(S[i]=="G")or(S[i] == "T")):
      break
    else:
      n += 1
  m = max(m,n)
  i += 1
print(m)

Submission status: Wrong Answer

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

b = input()

maxcnt = 0
scnt = 0
for c in b:
    if(c=='A' or c=='C' or c=='G' or c=='T'):
        scnt += 1
    else:
        if(maxcnt<scnt):
            maxcnt=scnt
        scnt = 0

print(maxcnt)

Submission status: Wrong Answer

Solution code:
def main():
    *S, = input()
    count = 0
    max = 0
    for i in S:
        if i == "A" or i == "C" or i == "G" or i == "T":
            count += 1
        else:
            if max < count:
                max = count
            count = 0
    print(max)
main()

Submission status: Wrong Answer

Solution code:
def main():
    *S, = input()
    count = 0
    max = 0
    for i in S:
        print(i)
        if i == "A" or i == "C" or i == "G" or i == "T":
            count += 1
        else:
            if max < count:
                max = count
            count = 0
    print(max)
main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import re

# str = input()

str = "HATAGAYA"

pattern = r"[ATCG]+"

matched_list = re.findall(pattern, str)

maxlength = 0
for item in matched_list:
    tmplength = len(item)
    if maxlength < tmplength:
        maxlength = tmplength

print(maxlength)

Submission status: Wrong Answer

Solution code:
acgt = ['A','C','G','T']
len_list = [0]
cur = 0
str = input()

for c in str:
  if(c in acgt):
    cur += 1
  else:
    len_list.append(cur)
    cur = 0
if(len(len_list) == 1):
  len_list.append(len(str))
print(max(len_list))

Submission status: Wrong Answer

Solution code:
acgt = ['A','C','G','T']
max = 0
cur = 0
str = input()

for c in str:
  if(c in acgt):
    cur += 1
  else:
    if(max < cur):
      max = cur
    cur = 0
if(len(str) == cur):
  max = cur
print(max)

Submission status: Wrong Answer

Solution code:
S = input()

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