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)):
    for j in range(i + 1, len(S)):
        s = S[i: j + 1]
        if set(s) <= {"A", "T", "C", "G"}:
            ans = max(ans, len(s))
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
m = a = 0
for c in input():
    if c in "ATGC": m+=1
    else: a = max(a, m); m = 0
else: print(a)

Submission status: Wrong Answer

Solution code:
s=list(map(str,input()))
for i in range(len(s)):
    s[i]='1' if (s[i]=='A' or s[i]=='C' or s[i]=='G' or s[i]=='T') else '0'
len(max(''.join(s).split('0'),key=len))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=list(input())
print(N)
count = 0
Scount = 0

for i in N:
  if i == "A" or i == "C" or  i == "G" or  i == "T":
    count += 1
    Scount = max(Scount,count)
  else:
    count = 0

print(Scount)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#KyoproRの競技プログラミング過去問配信
S = input()
k = []
b = ["A","C","G","T"]
a = 1
#ACGT文字列の長さがa
for i in range(len(S)):
    #len(S)の間roop
    #S[i]が"A" "C" "G" "T"のいずれかであるかを判定
    if S[i] in b:
        if i == len(S)-1:
            k.append(a)
            break
        else:
          for  j in range(1,len(S)-1):
              if S[i+j] in b:
                  if i+j == len(S)-1:
                      a += 1
                      k.append(a)
                      a = 1
                      print(k)
                      break
                  else:
                      a += 1
                      print(a)
              else:
                  k.append(a)
                  a = 1
                  print(k)
                  break
    else:
        if i == len(S)-1:
            break
if len(k) == 0:
    print(0)
else:
    print(max(k))

Submission status: Wrong Answer

Solution code:
#KyoproRの競技プログラミング過去問配信
S = input()
k = []
b = ["A","C","G","T"]
a = 1
#ACGT文字列の長さがa
for i in range(len(S)):
    #len(S)の間roop
    #S[i]が"A" "C" "G" "T"のいずれかであるかを判定
    if S[i] in b:
        if i == len(S)-1:
            k.append(a)
            break
        else:
        #構造見直します
          for  j in range(1,len(S)-1):
              if S[i+j] in b:
                  if i+j == len(S)-1:
                      k.append(a)
                      a = 1
                      break
                  else:
                      a += 1
              else:
                  k.append(a)
                  a = 1
                  break
    else:
        if i == len(S)-1:
            break
if len(k) == 0:
    print(0)
else:
    print(max(k))

Submission status: Wrong Answer

Solution code:
#KyoproRの競技プログラミング過去問配信
S = input()
k = []
b = ["A","C","G","T"]
a = 1
#ACGT文字列の長さがa
for i in range(len(S)):
    #len(S)の間roop
    #S[i]が"A" "C" "G" "T"のいずれかであるかを判定
    if S[i] in b:
        if i == len(S)-1:
            k.append(a)
            break
        else:
        #構造見直します
          for  j in range(1,len(S)-1):
              if S[i+j] in b:
                  if i+j == len(S)-1:
                      k.append(a)
                      a = 1
                      break
                  else:
                      a += 1
              else:
                  k.append(a)
                  a = 1
                  break
    else:
        if i == len(S)-1:
            break
print(k)
if len(k) == 0:
    print(0)
else:
    print(max(k))

Submission status: Wrong Answer

Solution code:
#KyoproRの競技プログラミング過去問配信
S = input()
k = []
b = ["A","C","G","T"]
a = 0
for i in range(len(S)-1):
    #len(S)の間roop
    #S[i]が"A" "C" "G" "T"のいずれかであるかを判定
    if S[i] in b:
        #構造見直します
        for  j in range(1,len(S)-1):
            if S[i+j] in b:
                if i+j == len(S)-1:
                    a += 1
                    k.append(a)
                    a = 0
                    break
                else:
                    a += 1
            else:
                k.append(a)
                break
    else:
        if i == len(S)-1:
            break
if len(k) == 0:
    print(0)
else:
    print(max(k))

Submission status: Wrong Answer

Solution code:
import os,re,sys,operator,math
from collections import Counter,deque
from operator import itemgetter
from itertools import accumulate,combinations,groupby
from sys import stdin,setrecursionlimit
from copy import deepcopy
import heapq
import string

setrecursionlimit(10**6)

s=stdin.readline().rstrip()
t="AGTC"
cnt,ans=0,0
for i in s:
    if i in t:
        cnt+=1
    else:
        ans=max(ans,cnt)
        cnt=0
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = [i for i in input()]
print(a.count("A")+a.count("C")+a.count("G")+a.count("T"))

Submission status: Wrong Answer

Solution code:
S = input()
A = [-2, -1]
for i in range(len(S)):
    A += [i]*(S[i] not in "ACGT")
print(max(b-a for a, b in zip(A, A[1:]) )-1)

Submission status: Wrong Answer

Solution code:
S = input()
A = [-1, -1]
for i in range(len(S)):
    A += [i]*(S[i] not in "ACGT")
print(max(b-a for a, b in zip(A, A[1:]) )-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
print(max([sum(1 for _ in s[1]) if [0] == 'A' else 0 for s in __import__('itertools').groupby(input().replace('T', 'A').replace('G', 'A').replace('C', 'A'))]))

Submission status: Wrong Answer

Solution code:
print(max([sum(1 for _ in s[1]) for s in __import__('itertools').groupby(input().replace('T', 'A').replace('G', 'A').replace('C', 'A'))]))

Submission status: Wrong Answer

Solution code:
s=list(input())

count=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':
    count+=1
  else:
    if max_<count:
      max_=count
    count=0
print(max_)

Submission status: Wrong Answer

Solution code:
S = input()
maxlen = 0
top = 0
while top < len(S):
    i = top
    while i < len(S):
        if S[i] == 'A' or S[i] =='C' or S[i] == 'G' or S[i] == 'T':
            i += 1
        else:
            break
    if maxlen < i - top:
        maxlen = i - top
    top += i+1

print(maxlen)

Submission status: Wrong Answer

Solution code:
s=input()

cnt=0
max_val=0
for s_ in s:
  if s_ in ('A', 'C', 'G', 'T'):
    cnt+=1
  else:
    max_val=max(cnt, max_val)
    cnt=0
print(max_val)

Submission status: Wrong Answer

Solution code:
import math
import copy

inputa = input().split()
# inputb = input().split()
# inputc = input().split()

# a = int(inputa[0])
# b = int(inputa[1])
# c = int(inputa[2])

a = inputa[0]
inputList = list(a)

# x = int(inputb[0])
# y = int(inputb[1])

# inputList=[]
# for i in range(a):
#     inputNum = input()
#     inputList.append(inputNum)
#
# inputList = [int(n) for n in inputList]

# b = [int(n) for n in inputb]
# c = [int(n) for n in inputc]

sum = 0
max = 0
ref = ["A", "C", "G", "T"]
for i in range(len(inputList)):
    flg = False
    for j in range(len(ref)):
        if inputList[i] == ref[j]:
            flg = True
            break

    if flg == False:
        if sum > max:
            max = sum
        sum = 0
    elif flg == True:
        sum += 1

print(max)

Submission status: Wrong Answer

Solution code:
s = input()

def chk(s):
	if s in 'ACGT':
		return 1
	else:
		return 0
c = 0
for i in s:
	c += chk(s)

print(c)

Submission status: Wrong Answer

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

print(a)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

S = input()
array = ["A", "C", "G", "T"]
ctr, max_ctr = 0, 0

for i in range(len(S)):
    if S[i] in array:
        ctr += 1
    else:
        if max_ctr < ctr:
            max_ctr = ctr
        ctr = 0
    
print(max_ctr)

Submission status: Wrong Answer

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

cnt = 0
maximum = 0
for s in S:
    if s in ACGT:
        cnt += 1
    else:
        maximum = max(maximum, cnt)
        cnt = 0

print(maximum)

Submission status: Wrong Answer

Solution code:
S=list(input())
N=len(S)
B=["A","C","G","T"]
c=[]
d=[0]
g=1
for i in range(1,N):
  if S[i] in  B and S[i-1] in B:
    g+=1
    d.append(g)
  elif S[i-1] in B or S[-1] in B:
    d.append(g)
print(max(d))

Submission status: Wrong Answer

Solution code:
S=list(input())
N=len(S)
B=["A","C","G","T"]
c=[]
d=[0]
g=1
for i in range(1,N):
  if S[i] in  B and S[i-1] in B:
    g+=1
    d.append(g)
  elif S[i-1] in B:
    d.append(g)
print(max(d))

Submission status: Wrong Answer

Solution code:
S=list(input())
N=len(S)
B=["A","C","G","T"]
c=[]
d=[0]
g=1
if S[0] in B:
  c.append(S[0])
for i in range(1,N):
  if S[i] in  B and S[i-1] in B:
    c.append(S[i])
    c.append(S[i-1])
    g+=1
    d.append(g)
print(max(d))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = list(input())
N = len(S)
li = []
agct = ["A","G","C","T"]   
ans=0
for i in range(N):
    if S[i] in agct:
        li.append(1)
    else:
        li.append(0)

from itertools import groupby

dst = [sum(1 for r in s) for t, s in groupby(li, key=lambda x: x == 1)]
print(max(dst))

Submission status: Wrong Answer

Solution code:
import re
print(max(map(len, re.split('[ACGT]',input()))))

Submission status: Wrong Answer

Solution code:
S = list(input())
l = len(S)
ans = 0
for i in range(l - 1):
  if S[i] == "A" or S[i] == "T" or S[i] == "G" or S[i] == "C":
    L = 1
    for j in range(i + 1, l):
      if S[j] == "A" or S[j] == "T" or S[j] == "G" or S[j] == "C":
        L += 1
      else:
        ans = max(ans, L)
        i = j
        break
    ans = max(ans, L)
  else:
    L = 0
print(ans)

Submission status: Wrong Answer

Solution code:
S = list(input())
l = len(S)
ans = 0
for i in range(l - 1):
  if S[i] == "A" or S[i] == "T" or S[i] == "G" or S[i] == "C":
    L = 1
    for j in range(i + 1, l):
      if S[j] == "A" or S[j] == "T" or S[j] == "G" or S[j] == "C":
        L += 1
      else:
        ans = max(ans, L)
        i = j
        break
    ans = max(ans, L)
print(ans)

Submission status: Wrong Answer

Solution code:
S = list(input())
l = len(S)
ans = 0
for i in range(l - 1):
  if S[i] == "A" or S[i] == "T" or S[i] == "G" or S[i] == "C":
    L = 1
    for j in range(i + 1, l):
      if S[j] == "A" or S[j] == "T" or S[j] == "G" or S[j] == "C":
        L += 1
      else:
        ans = max(ans, L)
        i = j
        break
print(ans)

Submission status: Wrong Answer

Solution code:
s=str(input())
a=0
b=0
for i in range(len(s)):
        if s[i] in 'AGCT':
                a+=1
        else:
                b=max(a,b)
                a=0
print(b)

Submission status: Wrong Answer

Solution code:
s=str(input())

l=[]
for i in range(len(s)):
        if s[i] == 'A':
                continue
        elif s[i] =='T':
                continue
        elif s[i] =='C':
                continue
        elif s[i] =='G':
                continue
        else:
                l.append(i)


if l==[]:
        print(len(s))
else:
        ans=l[0]
        for j in range(len(l)-1):
                if l[j+1]-l[j]-1>=ans:
                        ans=l[j+1]-l[j]-1
        print(ans)

Submission status: Wrong Answer

Solution code:
print("TGCA"["ACGT".find(input())])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

S = input()
ACGT = list('ACGT')

ret = 0
for c in S:
    if c in ACGT:
        ret += 1
    elif ret > 0:
        break

print(ret)

Submission status: Wrong Answer

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

ret = []
for c in S:
    if c in ACGT:
        ret.append(c)
    elif len(ret) > 0:
        break

print(len(ret))

Submission status: Wrong Answer

Solution code:
s=list(input())
cnt=0
ans=0
lis=["ATCG"]

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:


str = input()
acgt = set({'A','C','G','T'})

max_len = 0
work_len = 0
for c in str:
    if c in acgt:
        work_len += 1
    else:
        if max_len < work_len:
            max_len = work_len
        work_len = 0
print(max_len)

Submission status: Wrong Answer

Solution code:
s = input()

target = "ACGT"
max_len = 0
tmp_len = 0

for i in range(len(s)):
    if s[i] in target:
        tmp_len += 1
    else:
        max_len = max(tmp_len, max_len)
        tmp_len = 0
print(max_len)

Submission status: Wrong Answer

Solution code:
s = list(input())

max = 0
length = 0

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

print(max)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=input()

if s=='A': 
	res='T'
else:
	if s=='T':
		res='A'
	else:
		if s=='G':
			res='C'
		else:
			res='G'

print(res)

Submission status: Wrong Answer

Solution code:
s = input()
c = []
cnt = 0

for i, e in enumerate(s):
    if e == "A" or e == "C" or e == "G" or e == "T":
        cnt += 1
    else:
        c.append(cnt)
        cnt = 0
if c == []:
    c.append(cnt)
print(max(c))

Submission status: Wrong Answer

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

for i, e in enumerate(s):
    if e == "A" or e == "C" or e == "G" or e == "T":
        cnt += 1
    else:
        c.append(cnt)
        cnt = 0
print(max(c))

Submission status: Wrong Answer

Solution code:
s = list(str(input()))

count = 0
ACGT = ["A","C","G","T"]
tmp_max = [0]

if all(s) in ACGT:
	print(len(s))
else:
	for letter in s:
		if letter in ACGT:
			count += 1
		else:
			tmp_max.append(count)
			count = 0
	print(max(tmp_max))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def solve():
    S = input()
    max_sub = 0
    sub_length = 0
    for s in S:
        if s in 'ATGC':
            sub_length += 1
        else: 
            max_sub = max(max_sub, sub_length)
            sub_length = 0                
        
    print(max_sub)

solve()

Submission status: Wrong Answer

Solution code:
# ATCoder
S = input()

start = -1
end   = -1
length = 0
for i, s in enumerate(S):
	if s not in ['A','G','C','T']:
		end = i
		length_ = end - start - 1
		length = max(length_, length)
		start = end
		
print(max(length,0))

Submission status: Wrong Answer

Solution code:
s=str(input())
cnt=0
cntmax=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
        cntmax = max(cntmax, cnt)
    else:
        cnt == 0
print(cntmax)

Submission status: Wrong Answer

Solution code:
rec = []
cnt = 0
S_arr = [S for S in input()]
for i in range(len(S_arr)):
    if S_arr[i] == 'A' or S_arr[i] == 'T' or S_arr[i] == 'C' or S_arr[i] == 'G':
        cnt += 1
    elif cnt > 0 and S_arr[i] != 'A'or S_arr[i]!='T'or S_arr[i]!='C'or S_arr[i]!='G':
        rec.append(cnt)
        cnt = 0
if len(rec) == 0:
    rec.append(0)
rec_sort = sorted(rec)
print(rec_sort[len(rec) - 1])

Submission status: Wrong Answer

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


def check(T):
    M = len(T)
    for m in range(M):
        if T[m] not in "ATCG":
            return False
    return True


ans = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        T = S[i:j]
        if check(T):
            ans = max(ans, len(T))
print(ans)

Submission status: Wrong Answer

Solution code:
Str = list(input())
accum = []
acgt = "ACGT"
maxLen = 0

for s in Str:
    if acgt.count(s):
        accum.append(s)
    else:
        if len(accum) > maxLen:
            maxLen = len(accum)
        accum.clear()
        

print(maxLen)

Submission status: Wrong Answer

Solution code:
S = input()
S_list = list(S)

cnt = 0
max_s = 0

for s in S_list:
    if (s == "A") or (s == "C") or (s == "G") or (s == "T"):
        cnt += 1
    else:
        if max_s < cnt:
            max_s = cnt
        cnt = 0
print(max_s)

Submission status: Wrong Answer

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

cnt = 0

for i in range(N):
    for j in range(i, N):
        if all([s in "ACGT" for s in S[i:j]]):
            cnt = max(cnt, len(S[i:j]))

print(cnt)

Submission status: Wrong Answer

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

cnt = 0

for i in range(N):
    for j in range(i+1, N):
        if all([s in "ACGT" for s in S[i:j]]):
            cnt = max(cnt, j-i)

print(cnt)

Submission status: Wrong Answer

Solution code:
S = input()

atgc = ["A","T","G","C"]
count = 0
ans = 0
for i in range(len(S)):
	if S[i] in atgc:
		count += 1
	else:
		ans = max(ans,count)
		count = 0

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()

ans = 0
n = 0
for i in s:
    if i in 'ACGT':
        n += 1;
    else:
        if n > ans:
            ans = n
        n = 0
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = input()
b = 0
d = "ACGT"
for i in range(len(a)):
    if a[i] in d:
        c = 1
        for j in range(i+1, len(a)):
            if a[j] in d:
                c += 1
                b = max(b, c)
            else:
                break
print(b)

Submission status: Wrong Answer

Solution code:
n = input()
max_ = 0
m = 0
for i in range(len(n)):
    if n[i] == "A" or n[i] == "C" or n[i] == "T" or n[i] == "G":
        m += 1
    else:
        max_ = max(m,max_)
        m = 0
print(max_)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S=list(input())
li=0
li2=[]
for i in S:
	if i=='A' or i=='C' or i=='G' or i=='T':
		li+=1
	else:
		li2.append(li)
		li=0
if li2==[]:
	li2.append(li)
print(max(li2))

Submission status: Wrong Answer

Solution code:
s = str(input())

if set(list(s)) <= {'A', 'T', 'G', 'C'}:
  print(len(s))
  exit()

ans = 0

for i in range(len(s)):
  for j in range(i, len(s)):
    sp = s[i:j]
    sp = list(sp) 
    if set(sp) <= {'A', 'T', 'G', 'C'}:
      ans = max(ans, len(sp))
print(ans)

Submission status: Wrong Answer

Solution code:
s = str(input())

ans = 0

for i in range(len(s)):
  for j in range(i, len(s)):
    sp = s[i:j]
    sp = list(sp) 
    if set(sp) <= {'A', 'T', 'G', 'C'}:
      ans = max(ans, len(sp))
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

def ACGT (char):
    return char == "A" or char =="T" or char == "G" or char == "C"

for i in range(len(s)):
    if ACGT(s[i]):
        j = 0
        for j in range(i, len(s)):
            if not ACGT(s[j]):
                ans.append(j - i)
                break
ans.sort()
print(ans[-1])

Submission status: Wrong Answer

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

def ACGT (char):
    return char == "A" or char =="T" or char == "G" or char == "C"

for i in range(len(s)):
    if ACGT(s[i]):
        j = 0
        for j in range(i + 1, len(s)):
            if not ACGT(s[j]):
                ans.append(j - i)
                break
ans.sort()
print(ans[-1])

Submission status: Wrong Answer

Solution code:
s = input()

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

Submission status: Wrong Answer

Solution code:
S = input()

len_s = len(S)
bases = ('A', 'C,', 'G', 'T')

ans = 0
cnt = 0

for i in range(len_s):
  if S[i] in bases:
    cnt += 1
  else:
    ans = max(ans, cnt)
    cnt = 0
if cnt > 0:
  ans = max(ans, cnt)
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()

ans = 0
tmp = 0
flag = False

for i in S:
    if (i == "A") or (i == "C") or (i == "G") or (i == "T"):
        tmp += 1
        flag = True
    elif (tmp > ans) and flag:
        ans = tmp
        tmp = 0
        flag = False
    elif flag:
        tmp = 0
        flag = False

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=input()
max=0
cnt=0
for _ in s:
    if _ == 'A' or _ == 'G' or _ == 'T' or _ == 'C':
        cnt+=1
    else:
        if max < cnt:
            max = cnt
        cnt=0

Submission status: Wrong Answer

Solution code:
s = list(input())

ans = 0

for i in range(len(s)):
    if(s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T"):
        for j in range(i+1,len(s)):
            if(s[j] != "A" and s[j] != "C" and s[j] != "G" and s[j] != "T"):
            #    print("{},{}".format(i,j))
                ans = max(ans,j-i)
                i = j    
                break
    
            

print(ans)

Submission status: Wrong Answer

Solution code:
s = list(input())

ans = 0

for i in range(len(s)):
    if(s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T"):
        for j in range(i+1,len(s)):
            if(s[j] != "A" and s[j] != "C" and s[j] != "G" and s[j] != "T"):
                print("{},{}".format(i,j))
                ans = max(ans,j-i)
                i = j    
                break
    
            

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
acgt = {'A','C','G','T'}
max_len = 0
count=0
for si in s:  
  if si in acgt:
    count+=1
  else:
    if max_len < count :
      max_len = count
    count=0
print(max_len)

Submission status: Wrong Answer

Solution code:
S = list(input())
acgt = ['A', 'C', 'G', 'T']
lengths = []
l = 0
for x in S:
  if x in acgt:
    l += 1
  else:
    lengths.append(l)
    l = 0

if len(lengths)==0:
  lengths.append(l)

print(max(lengths))

Submission status: Wrong Answer

Solution code:
S = list(input())
acgt = ['A', 'C', 'G', 'T']
lengths = []
l = 0
for x in S:
  if x in acgt:
    l += 1
  else:
    lengths.append(l)
    l = 0

if len(lengths)==0:
  lengths.append(l)

print(lengths)

Submission status: Wrong Answer

Solution code:
S = list(input())
acgt = ['A', 'C', 'G', 'T']
lengths = [0]
l = 0
for x in S:
  if x in acgt:
    l += 1
  else:
    lengths.append(l)
    l = 0
print(max(lengths))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=input()
n=len(s)
list=["A","C","G","T"]
new=[]
a=0
for i in range(n):
  if s[i] in list:
    a+=1
    if i == n-1:
      new.append(a)
  if s[i] not in list:
    new.append(a)
    a=0
print(new)

Submission status: Wrong Answer

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

    len_max = 0
    len_cur = 0
    for t in s:
        if t in {'A', 'C', 'G', 'T'}:
            len_cur += 1
        else:
            len_max = max(len_max, len_cur)
            len_cur = 0

    print(len_max)


main()

Submission status: Wrong Answer

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

S = input()

acgt = {'A', 'C', 'G', 'T'}
longest = 0
length = 0
for c in S:
    if c in acgt:
        length += 1
    else:
        longest = max(length, longest)
        length = 0

print(longest)

Submission status: Wrong Answer

Solution code:
s = input()

s = s.replace("A", "0")
s = s.replace("C", "0")
s = s.replace("G", "0")
s = s.replace("T", "0")

index = 0
count = 0
count_list = []

while index < len(s):
    if s[index] == "0":
        count += 1
        for i in range(index+1, len(s)):
            if s[i] == "0":
                count += 1
            else:
                count_list.append(count)
                count = 0
                index = i
                break
        index += 1

if len(count_list) != 0:
    print(sorted(count_list)[0])
else:
    print(0)

Submission status: Wrong Answer

Solution code:
s = input()

s = s.replace("A", "0")
s = s.replace("C", "0")
s = s.replace("G", "0")
s = s.replace("T", "0")

index = 0
count = 0
count_list = []

while index < len(s):
    if s[index] == "0":
        count += 1
        for i in range(index+1, len(s)):
            if s[i] == "0":
                count += 1
            else:
                count_list.append(count)
                count = 0
                index = i + 1
                break
    index += 1

if len(count_list) != 0:
    print(sorted(count_list)[0])
else:
    print(0)

Submission status: Wrong Answer

Solution code:
S = input()
s = []
a = 1
b = []
for i in range(len(S)):
    if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
        s.append(i)
if len(s) == 0:
    print(0)
    exit()
for j in range(len(s) - 1):
    if s[j] + 1 == s[j + 1]:
        a += 1
    else:
        b.append(a)
        a = 0
b.append(a)
print(max(b))