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()
ans = 0
for i in range(len(S)):
    tmp = 0
    for j in range(len(S)):
        if 'ACGT'.count(S[j]) == 1:
            tmp += 1
        else:
            ans = max(ans, tmp)
            tmp = 0

print(ans)

Submission status: Wrong Answer

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

for i in range(len(s)):
    if l.count(s[i]) != 0:
        tmp+=1
    else:
        ans=max(tmp,ans)
        tmp=0
print(ans)

Submission status: Wrong Answer

Solution code:

s = input()

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

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
ans = 0
cnt = 0
acgt = ['A','C','G','T']
for c in S:
    if c in acgt:
        cnt += 1
    else:
        if cnt > ans:
            ans = cnt
            cnt = 0

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()

count = 0
max_count = 0
for c in s:
    if c in ['A', 'C', 'G', 'T']:
        count += 1
    else:
        if count > max_count:
            max_count = count
        count = 0

print(max_count)

Submission status: Wrong Answer

Solution code:
S = raw_input()

AGCT = ["A", "G", "C", "T"]

ans = 0
candi = 0
for item in S:
    if item in AGCT:
        candi = candi + 1
    else:
        ans = max(ans, candi)
        candi = 0

print ans

Submission status: Wrong Answer

Solution code:
s = input()
n = len(s)

ans = 0
for i in range(n):
    for j in range(i+1):
        if all([a in 'ATGC' for a in s[j:i]]):
            ans = max(ans, len(s[j:i]))
print(ans)

Submission status: Wrong Answer

Solution code:
a=[i for  i in input()]
st=['A','C','G','T'] ; ct=0 ; maxx=0
for i in a:
    if i in st:
        ct+=1
    else:
        maxx=max(maxx,ct)
        ct=0
print(maxx)

Submission status: Wrong Answer

Solution code:
import re

split = re.split('[^ACGT]', input())
print(split)
print(max(map(len, split)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S=input()
start=1
end=0
ans=[]
for _ in range(len(S)):
    for i in range(len(S))[end:]:
        if S[i] in {"A","C","G","T"}:
            start=i
            break
    for j in range(len(S))[start:len(S)]:
        end=len(S)
        if S[j] not in {"A","C","G","T"}:
            end=j
            break
    ans.append(end-start)
if max(ans)<0:print(1)
else:print(max(ans))

Submission status: Wrong Answer

Solution code:
S=input()
start=1
end=0
ans=[]
for _ in range(len(S)):
    for i in range(len(S))[end:]:
        if S[i] in {"A","C","G","T"}:
            start=i
            break
    for j in range(len(S))[start:len(S)]:
        end=len(S)
        if S[j] not in {"A","C","G","T"}:
            end=j
            break
    ans.append(end-start)
print(max(ans))

Submission status: Wrong Answer

Solution code:
S=input()
start=0
end=0
for i in range(len(S)):
    if S[i] in {"A","C","G","T"}:
        start=i
        break
for j in range(len(S))[start:]:
    if S[j] not in {"A","C","G","T"}:
        end=j
        break
print(end-start)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = [1 if i in ["A", "C", "G", "T"] else 0 for i in input()]
r = [0]
c = 0
for i, si in enumerate(s):
    if si == 1:
        c += 1
    elif si == 0 or i == len(s) - 1:
        if c != 0:
            r.append(c)
            c = 0
print(max(r))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(len(s)):
    if s[i] in acgt:
        moji=s[i]
        cnt=1
        while i+cnt < len(s):
            if s[i+cnt] in acgt:
                moji=s[i:i+cnt+1]
                # print(moji)
                cnt+=1
                l.append(len(moji))
            else:
                l.append(len(moji))
                break
print(max(l))

Submission status: Wrong Answer

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

for i in range(len(s)):
    if s[i] in acgt:
        moji=s[i]
        cnt=1
        while i+cnt < len(s):
            if s[i+cnt] in acgt:
                moji=s[i:i+cnt+1]
                # print(moji)
                cnt+=1
                l.append(len(moji))
            else:
                break
print(max(l))

Submission status: Wrong Answer

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

for i in range(len(s)):
    if s[i] in acgt:
        moji=s[i]
        for j in range(i,len(s)+1):
            # print(s[i:j])
            if s[j-1] in acgt:
                moji = s[i:j]
        # print(moji)
        l.append(len(moji))
print(max(l))

Submission status: Wrong Answer

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

for i in range(len(s)):
    if s[i] in acgt:
        moji=s[i]
        for j in range(i,len(s)):
            # print(s[i:j])
            if s[j-1] in acgt:
                moji = s[i:j]
        # print(moji)
        l.append(len(moji))
print(max(l))

Submission status: Wrong Answer

Solution code:
s=input()

acgt=["A","C","G","T"]

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S=list(input())

ACGT=['A','C','G','T']
tmp=''
MAX1=0
MAX2=0

for moji in S:
    if((moji in ACGT)==True):
        tmp+=moji
        MAX2=len(tmp)
    else:
        if(MAX1 < MAX2):
            MAX1=MAX2
        MAX2=0
        tmp=''

if(MAX1==0 and MAX2!=0):
    MAX1=MAX2

print(MAX1)

Submission status: Wrong Answer

Solution code:
S=list(input())

ACGT=['A','C','G','T']
tmp=''
MAX1=0
MAX2=0

for moji in S:
    if((moji in ACGT)==True):
        tmp+=moji
        MAX2=len(tmp)
    else:
        if(MAX1 < MAX2):
            MAX1=MAX2
        MAX2=0
        tmp=''

print(MAX1)

Submission status: Wrong Answer

Solution code:
def main():
    S = input()
    N = len(S)
    s = {"A", "G", "C", "T"}
    ans = 0
    for i in range(N):
        for j in range(i, N):
            T = S[i:(j-i+1)]
            if all(t in s for t in T):
                ans = max(ans, len(T))
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import Counter

S = input()

ans = 0

for s in range(len(S)):
    for e in range(s + 1, len(S)):
        if set(S[s:e]) <= set({'A', 'T', 'C', 'G'}):
            ans = max(ans, e - s)
        # print(s, e, S[s:e], set(S[s:e]), set(S[s:e]) <= set({'A', 'T', 'C', 'G'}))
print(ans)

Submission status: Wrong Answer

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

length = 0

for s in range(n-1):
    for e in range(s+1, n):
        if all("ACGT".count(c)==1 for c in S[s:e+1]):
            length = max(length, e-s+1)

print(length)

Submission status: Wrong Answer

Solution code:
s = input()
ans = [0] * 10 ** 3
cnt = 0

for i in range(len(s)):
    for j in range(2, len(s) + 1):
        memo = s[i:j]
        for k in range(len(memo)):
            if memo[k] == 'A' or memo[k] == 'C' or memo[k] == 'T' or memo[k] == 'G':
                cnt += 1
            else:
                break

        ans.append(cnt)
        cnt = 0

print(max(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

length = 0

for s in range(n-1):
    if S[s] not in ["A", "C", "G", "T"]:
        continue
    length = max(length, 1)
    for e in range(s+1, n):
        if S[e] not in ["A", "C", "G", "T"]:
            break
        length = max(length, e-s+1)

print(length)

Submission status: Wrong Answer

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

length = 0

for s in range(n-1):
    if S[s] not in ["A", "C", "G", "T"]:
        continue
    length = 1
    for e in range(s+1, n):
        if S[e] not in ["A", "C", "G", "T"]:
            break
        length = max(length, e-s+1)

print(length)

Submission status: Wrong Answer

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

length = 0

for s in range(n-1):
    if S[s] not in ["A", "C", "G", "T"]:
        continue
    for e in range(s+1, n):
        if S[e] not in ["A", "C", "G", "T"]:
            break
        length = max(length, e-s+1)

print(length)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import Counter
import sys

sys.setrecursionlimit(10 ** 6)

mod = 1000000007
inf = int(1e18)

dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]


def inverse(a):
    return pow(a, mod - 2, mod)


def usearch(x, a):
    lft = 0
    rgt = len(a) + 1
    while rgt - lft > 1:
        mid = (rgt + lft) // 2
        if a[mid] <= x:
            lft = mid
        else:
            rgt = mid
    return lft

def main():
    s = input()
    ans = 0
    n = len(s)
    for i in range(n):
        for j in range(i+1, n):
            if len([k for k in s[i:j] if k not in 'ACGT']) == 0:
                ans = max(ans, j - i)
    print(ans)


main()

Submission status: Wrong Answer

Solution code:
s=input()

ans=0
count=0
for i in s:
    if i in 'ACGT':count+=1
    else:
        ans=max(ans,count)
        count=0
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()

cnt = 0
max_cnt = 0

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

Submission status: Wrong Answer

Solution code:
S = input()
ACGT = 'ACGT'
ans = 0
temp = 0
for x in S:
    if x in ACGT:
        temp += 1
    else:
        ans = max(ans, temp)
        temp = 0
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()

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

Submission status: Wrong Answer

Solution code:
S = input()
L = [s in "ACGT" for s in S]
ans, cnt = 0, 0
for l in L:
  if l == True:
    cnt += 1
  else:
    ans = max(ans, cnt)
    cnt = 0
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def judacgt(c):
    return c=="A" or c=="G" or c=="C" or c=="T"


s = input()

max = 0

for i in range(len(s)):
    if judacgt(s[i]):
        for j in range(i+1,len(s)):
            # print(s[i:j])
            if judacgt(s[j])==False:
                break
            elif j-i+1 > max:
                max=j-i+1
print(max)

Submission status: Wrong Answer

Solution code:
import sys
from math import *
from collections import deque, Counter, defaultdict
from fractions import gcd
input = lambda: sys.stdin.readline().rstrip()

def eprint(s):
    sys.stderr.write('DEBUG: {}'.format(s))
    return

def main():
    s = input()
    n = len(s)

    cnt = 0
    cf = False
    cnts = list()

    for i in range(n):
        if s[i] in ['A', 'C', 'G', 'T']:
            cf = True
            cnt += 1
        elif cf:
            cf = False
            cnts.append(cnt)
            cnt = 0
    if  cnts:
        print(max(cnts))
    else:
        print(0)
    return

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
from math import *
from collections import deque, Counter, defaultdict
from fractions import gcd
input = lambda: sys.stdin.readline().rstrip()

def eprint(s):
    sys.stderr.write('DEBUG: {}'.format(s))
    return

def main():
    s = input()
    n = len(s)

    cnt = 0
    cf = False
    cnts = list()

    for i in range(n):
        if s[i] in ['A', 'C', 'G', 'T']:
            cf = True
            cnt += 1
        elif cf:
            cf = False
            cnt = 0
            cnts.append(cnt)
    if  cnts:
        print(max(cnts))
    else:
        print(0)
    return

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
from math import *
from collections import deque, Counter, defaultdict
from fractions import gcd
input = lambda: sys.stdin.readline().rstrip()

def eprint(s):
    sys.stderr.write('DEBUG: {}'.format(s))
    return

def main():
    s = input()
    n = len(s)

    cnt = 0
    cf = False
    cnts = list()

    for i in range(n):
        if s[i] in ['A', 'C', 'G', 'T']:
            cf = True
            cnt += 1
        elif cf:
            cf = False
            cnts.append(cnt)
    if  cnts:
        print(max(cnts))
    else:
        print(0)
    return

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
s = list(input())

acgt = ['A', 'C', 'G', 'T']
c = 0
m = 0
for i in range(len(s)):
    if not s[i] in acgt:
        if m < c:
            m = c
        c = 0
    else:
        c += 1

print(m)

Submission status: Wrong Answer

Solution code:
S = input()
N = len(S)
ACGT = []
others = 'BDEFHIJKLMNOPQRSUVWXYZ'
for i in range(N):
    fl = True
    for j in range(i+1,N+1):
        tmp_S = S[i:j]
        M = len(tmp_S)
        for k in range(M):
            if tmp_S[k] in others:
                fl = False
        if fl==False:
            break
        ACGT.append(tmp_S)
print(ACGT)
len_ACGT = [len(x) for x in ACGT]
print(max(len_ACGT)) if len(len_ACGT)>0 else print(0)

Submission status: Wrong Answer

Solution code:
S = input()
N = len(S)
ACGT = []
others = 'BDEFHIJKLMNOPQRSUVWXYZ'
for i in range(N):
    fl = True
    for j in range(i+1,N):
        tmp_S = S[i:j]
        M = len(tmp_S)
        for k in range(M):
            if tmp_S[k] in others:
                fl = False
        if fl==False:
            break
        ACGT.append(tmp_S)

len_ACGT = [len(x) for x in ACGT]
print(max(len_ACGT)) if len(len_ACGT)>0 else print(0)

Submission status: Wrong Answer

Solution code:
import sys

import numpy as np
import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect import bisect_left, bisect_right, insort_left, insort_right
from operator import itemgetter as ig
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
INF = float("INF")
mod = 10 ** 9 + 7
"""dd = [(-1, 0), (0, 1), (1, 0), (0, -1)];
ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)];
ddn9 = ddn + [(0, 0)]
for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:"""

def wi(): return list(map(int, sys.stdin.readline().split()))
def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]  # WideIntPoint
def ws(): return sys.stdin.readline().split()
def si(): return int(sys.stdin.readline())  # SingleInt
def ss(): return input()
def hi(n): return [si() for _ in range(n)]
def hs(n): return [ss() for _ in range(n)]  # HeightString
def s_list(): return list(input())
def mi(n): return [wi() for _ in range(n)]  # MatrixInt
def mip(n): return [wip() for _ in range(n)]
def ms(n): return [ws() for _ in range(n)]
def num_grid(n): return [[int(i) for i in sys.stdin.readline().split()[0]] for _ in range(n)]  # NumberGrid
def grid(n): return [s_list() for _ in range(n)]


def main():

    s = input()
    ans = 0
    now = 0
    isATCG = False
    for i in range(len(s)):
        if s[i] in ["A", "G", "C", "T"]:
           isATCG = True

        if isATCG == False:
            now = 0
        else:
            now += 1
            ans = max(now,ans)

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys

import numpy as np
import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect import bisect_left, bisect_right, insort_left, insort_right
from operator import itemgetter as ig
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
INF = float("INF")
mod = 10 ** 9 + 7
"""dd = [(-1, 0), (0, 1), (1, 0), (0, -1)];
ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)];
ddn9 = ddn + [(0, 0)]
for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:"""

def wi(): return list(map(int, sys.stdin.readline().split()))
def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]  # WideIntPoint
def ws(): return sys.stdin.readline().split()
def si(): return int(sys.stdin.readline())  # SingleInt
def ss(): return input()
def hi(n): return [si() for _ in range(n)]
def hs(n): return [ss() for _ in range(n)]  # HeightString
def s_list(): return list(input())
def mi(n): return [wi() for _ in range(n)]  # MatrixInt
def mip(n): return [wip() for _ in range(n)]
def ms(n): return [ws() for _ in range(n)]
def num_grid(n): return [[int(i) for i in sys.stdin.readline().split()[0]] for _ in range(n)]  # NumberGrid
def grid(n): return [s_list() for _ in range(n)]


def main():

    s = input()
    ans = 0
    now = 0
    isATCG = False
    for i in range(len(s)):
        if s[i] == "A" or s[i] =="T" or s[i] =="C" or s[i] =="G":
           isATCG = True

        if isATCG == False:
            now = 0
        else:
            now += 1
            ans = max(now,ans)

    print(ans)
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
s = input()

count = 0
for i in range(len(s)-1):
    c=0
    if s[i]!='A' and s[i]!='C' and s[i]!='G' and s[i]!='T':
        continue
    c=1
    for j in range(i+1,len(s)):
        if s[j]!='A' and s[j]!='C' and s[j]!='G' and s[j]!='T':
            break
        else:
            c+=1
    count = c if count<c else count
print(count)

Submission status: Wrong Answer

Solution code:
s = input()

count = 0
for i in range(len(s)-1):
    c=0
    if s[i]!='A' and s[i]!='C' and s[i]!='G' and s[i]!='T':
        continue
    c=1
    for j in range(i+1,len(s)):
        if s[j]!='A' and s[j]!='C' and s[j]!='G' and s[j]!='T':
            count = c if count<c else count
            break
        else:
            c+=1
print(count)

Submission status: Wrong Answer

Solution code:
s = list(input())
t = ["A", "C", "G", "T"]
c, m = 0, 0
for i in s:
    if i in t:
        c += 1
    else:
        if m < c:
            m = c
        c = 0
print(m)

Submission status: Wrong Answer

Solution code:
str = input()

ans=0
temp=0
for i in range(len(str)):
  if str[i] in 'ACGT':
    temp += 1
  else:
    if ans < temp:
      ans = temp
    temp = 0

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()

len_ACGT = 0
canCount = False
max_len = 0
for s in S:
  if (s in "ACGT"):
    if(canCount == False):
      canCount = True
    len_ACGT += 1
  else:
    if(canCount == True):
      if(len_ACGT > max_len):
        max_len = len_ACGT
      canCount = False
      len_ACGT = 0
print(max_len)

Submission status: Wrong Answer

Solution code:
import string

S = input()

target = set({'A', 'T', 'C', 'G'})

ss = ''
for i in range(len(S)):
    for d in range(1, min(len(S) - i + 1, 10)):
        SS = S[i:i+d]
        flag = True
        for c in string.ascii_letters:
            if c.upper() in SS and c.upper() not in target:
                flag = False
        if flag and len(ss) < len(SS):
            ss = SS
print(len(ss))

Submission status: Wrong Answer

Solution code:
S = input()
T = set(list('AGCT'))

ans = 0
for l in range(len(S)):
    for r in range(l + 1, len(S) + 1):
        if set(S[l: r]) < T:
            ans = max(ans, r - l)

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
T = set(list('AGCT'))

ans = 0
for l in range(len(S)):
    for r in range(l + 1, len(S)):
        if set(S[l:r]) < T:
            ans = max(ans, r - l)

print(ans)

Submission status: Wrong Answer

Solution code:
*s, = input()

s.append("")

c = 0
ans = 0
for i in range(len(s)):
    if s[i] not in "ACGT":
        ans = max(ans, i - c)
        c = i + 1

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
ACGT_str = 'ACGT'

res = 0
max_res = 0
for i in range(len(S)):
  flag = 0
  for j in range(len(ACGT_str)):
    if S[i] == ACGT_str[j]:
      flag = 1
  
  if flag == 1:
    res += 1
  else:
    if res > max_res:
      max_res = res

print(max_res)

Submission status: Wrong Answer

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

S = input().strip()

max_cnt=0
cnt=0
for i in range(len(S)):
    
    if S[i] in "ACGT":
        cnt += 1
    else:
        max_cnt = max(max_cnt,cnt)
        cnt = 0

print(max_cnt)

Submission status: Wrong Answer

Solution code:
S = str(input())
sam = ['A','C','G','T']
box = []
count = 0
for i in range(len(S)):
    if i == 0 and S[i] in sam:
        count+=1
    elif i > 0:
        if count == 0 and S[i] in sam:
            count+=1
        elif S[i] in sam and S[i-1] in sam:
            count+=1
        else:
            box.append(count)
            count=0
        
print(count)

Submission status: Wrong Answer

Solution code:
S = str(input())
sam = ['A','C','G','T']
count = 0
for i in range(len(S)):
    if i == 0 and S[i] in sam:
        count+=1
    elif i > 0:
        if count == 0 and S[i] in sam:
            count+=1
        elif S[i] in sam and S[i-1] in sam:
            count+=1
        
print(count)

Submission status: Wrong Answer

Solution code:
S = input()
n = len(S)
ans = 0
flag = True
for i in range(n):
  for j in range(i):
    for k in range(i,n+1):
      S_part = S[j:k]
      for s in S_part:
        if not s in "ACGT":
          flag = False
      if flag:
        ans = max(ans,len(S_part))
      flag = True
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
n = len(S)
ans = 0
flag = True
for i in range(n):
  for j in range(i):
    for k in range(i,n):
      S_part = S[j:k+1]
      for s in S_part:
        if not s in "ACGT":
          flag = False
      if flag:
        ans = max(ans,len(S_part))
      flag = True
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
n = len(S)
ans = 0

for i in range(n):
  for j in range(i,n):
    if S[j] not in "ACGT":
      ans = max(ans,j-i)
      break
      
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()

src = ["A","T","C","G"]
ok = True
ans = 0
tmp = 0
for s in S:
    if s in src:
        tmp += 1
        ok = True
    else:
        ok = False
        ans = max(ans, tmp)
        tmp = 0
        continue

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]=="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:
def main():
    s = input()
    acgt = set("ACGT")
    max_len = 0
    for i in range(len(s)+1):
        for j in range(i+1, len(s)+1):
            p = s[i:j]
            print(p)
            if set(p) <= acgt:
                max_len = max(len(p), max_len)
    print(max_len)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    s = input()
    acgt = set("ACGT")
    max_len = 0
    for i in range(len(s)):
        for j in range(i+1, len(s)):
            p = s[i:j]
            if set(p) <= acgt:
                max_len = max(len(p), max_len)
    print(max_len)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
import copy
from operator import mul
from functools import reduce
from collections import defaultdict
from collections import Counter
from collections import deque
# 直積 A={a, b, c}, B={d, e}:のとき，A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(seq), 順列 {}_len(seq) P_n: permutations(seq, n)
from itertools import permutations
# 組み合わせ {}_len(seq) C_n: combinations(seq, n)
from itertools import combinations
from bisect import bisect_left, bisect_right
# import numpy as np

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W

# 四方向: 右, 下, 左, 上
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]

def i_inpl(): return int(input())
def l_inpl(): return list(map(int, input().split()))
INF = float("inf")

######
# URL: https://atcoder.jp/contests/abc122/tasks/abc122_b
######

def main():
    S = input()
    ans = 0
    for begin in range(len(S)):
        for end in range(begin, len(S)):
            if sum([ "ACGT".count(s) for s in S[begin:end+1]]) == end - begin - 1:
                ans = max(ans, end - begin - 1)
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import math
import copy
from operator import mul
from functools import reduce
from collections import defaultdict
from collections import Counter
from collections import deque
# 直積 A={a, b, c}, B={d, e}:のとき，A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(seq), 順列 {}_len(seq) P_n: permutations(seq, n)
from itertools import permutations
# 組み合わせ {}_len(seq) C_n: combinations(seq, n)
from itertools import combinations
from bisect import bisect_left, bisect_right
# import numpy as np

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W

# 四方向: 右, 下, 左, 上
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]

def i_inpl(): return int(input())
def l_inpl(): return list(map(int, input().split()))
INF = float("inf")

######
# URL: https://atcoder.jp/contests/abc122/tasks/abc122_b
######

def main():
    S = input()
    ans = 0
    for begin in range(len(S)):
        for end in range(begin, len(S)):
            tmp = 0
            for i in range(begin, end+1):
                if S[i] in ["A", "C", "G", "T"]:
                    tmp += 1
                else:
                    ans = max(ans, tmp)
                    tmp = 0
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import math
import copy
from operator import mul
from functools import reduce
from collections import defaultdict
from collections import Counter
from collections import deque
# 直積 A={a, b, c}, B={d, e}:のとき，A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(seq), 順列 {}_len(seq) P_n: permutations(seq, n)
from itertools import permutations
# 組み合わせ {}_len(seq) C_n: combinations(seq, n)
from itertools import combinations
from bisect import bisect_left, bisect_right
# import numpy as np

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W

# 四方向: 右, 下, 左, 上
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]

def i_inpl(): return int(input())
def l_inpl(): return list(map(int, input().split()))
INF = float("inf")

######
# URL: https://atcoder.jp/contests/abc122/tasks/abc122_b
######

def main():
    S = input()
    ans = 0
    tmp = 0
    for i in range(len(S)):
        if S[i] in ["A", "C", "G", "T"]:
            tmp += 1
        else:
            ans = max(ans, tmp)
            tmp = 0
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

S = read().decode().rstrip()
ans = 0

for l in range(0, len(S)):
    for r in range(l + 1, len(S)):
        flag = True
        for c in [
                "B", "D", "E", "F", "H", "I", "J", "K", "L", "M", "N", "O", "P",
                "Q", "R", "S", "U", "V", "W", "X", "Y", "Z"
        ]:
            if c in S[l:r]:
                flag = False
        if flag:
            ans = max(ans, r - l)

print(ans)