Problem:


Score : 200 points

Problem Statement

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

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

Notes

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

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

Constraints

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

Each character in S is an uppercase English letter.

Input

Input is given from Standard Input in the following format:

S

Output

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

Sample Input 1

ATCODER

Sample Output 1

3

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

Sample Input 2

HATAGAYA

Sample Output 2

5

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

Sample Input 3

SHINJUKU

Sample Output 3

0

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



Sample input:
ATCODER


Sample output:
3

Submission status: Wrong Answer

Solution code:
def check_ACGT(S):
    length = len(S)
    for i in range(length):
        if not(S[i] == "A" or  S[i] == "G" or S[i] == "C" or S[i] == "T"):
            return 0
    
    return length

S = input()

tmp = 0
length = len(S)
for i in range(length):
    for j in range(i+1, length):
            tmp = max(tmp, check_ACGT(S[i:j+1]))

print(tmp)

Submission status: Wrong Answer

Solution code:
S = input()

answer = ''
number_of_consecutive_times = 0
maxium_number_of_consecutive_times = 0
for char in S:
    includes = ['A', 'C', 'G', 'T']
    is_included = char in includes

    if is_included:
        number_of_consecutive_times += 1
    else:
        maxium_number_of_consecutive_times = max(
            number_of_consecutive_times,
            maxium_number_of_consecutive_times,)
        number_of_consecutive_times = 0

print(maxium_number_of_consecutive_times)

Submission status: Wrong Answer

Solution code:
S = input()

answer = ''
for char in S:
    includes = ['A', 'C', 'G', 'T']
    is_included = char in includes
    if not is_included: continue

    answer += char

answer = len(answer)

print(answer)

Submission status: Wrong Answer

Solution code:
b = input()

base_pairs = {
    'A': 'T', 
    'C': 'G',
    'G': 'C',
    'T': 'A',
}

pair = base_pairs.get(b)

print(pair)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

se = {'A', 'C', 'G', 'T'}
S = sr()
cand = []
answer = []
for s in S:
    if s in se:
        cand.append(s)
    else:
        if len(cand) > len(answer):
            answer = cand
        cand = []

print(len(answer))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    S = input()
    maxlen = 0
    for i in range(len(S)):
        for j in reversed(range(len(S))):
            if i <= j:
                c = 0
                for k in range(i, j):
                    if S[k] == "A" or S[k] == "C" or S[k] == "G" or S[k] == "T":
                        c += 1
                    else:
                        break
                if c > maxlen:
                    maxlen = c
    print(maxlen)
main()

Submission status: Wrong Answer

Solution code:
s = input()
answer = 0
for left in range(len(s)):
    for right in range(left+1, len(s)):
        if set(s[left:right+1]) <= set("ACGT"):
            answer = max(answer, right - left +1)
print(answer)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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
print(max)

Submission status: Wrong Answer

Solution code:
def ATCoder(S):
    count = 0
    res = 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 count > res:
                res = count
            count = 0
    return res



if __name__ == "__main__":
    S = str(input())
    print(ATCoder(S))

Submission status: Wrong Answer

Solution code:
def ATCoder(S):
    count = 0
    res = 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 count > res:
                res = count
            count = 0
    return res



if __name__ == "__main__":
    S = str(input())
    print(ATCoder(S))

Submission status: Wrong Answer

Solution code:
x = list(input())

y = 0
z = 0
for i in range(len(x)):
    if x[i] in ['A', 'C', 'G', 'T']:
        y += 1
    else:
        z = max (z,y)
        y = 0

print(z)

Submission status: Wrong Answer

Solution code:
s = input()
n = len(s)
ans = -1e9
for i in range(n):
    for j in range(i, n):
        ok = True
        for k in range(i, j + 1):
            if s[k] not in ['A', 'T', 'G', 'C']:
                ok = False
        if ok:
            ans = max(ans, j - i + 1)
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
chrlis = []
for i in range(len(s)):
  if s[i]=="A" or s[i]=="C" or s[i]=="G" or s[i]=="T":
    start = i
    for j in range(i,len(s)):
      if s[j]=="A" or s[j]=="C" or s[j]=="G" or s[j]=="T":
        end = j
      else:
        break
  else:
    continue
  chrlis.append(s[start:end+1])

ans = 0
for i in range(len(chrlis)):
  tmp = len(chrlis[i])
  if tmp>ans:
    ans = tmp
print(chrlis,ans)

Submission status: Wrong Answer

Solution code:
s = input()
chrlis = []
for i in range(len(s)):
  if s[i]=="A" or s[i]=="C" or s[i]=="G" or s[i]=="T":
    start = i
    for j in range(i,len(s)):
      if s[j]=="A" or s[j]=="C" or s[j]=="G" or s[j]=="T":
        end = j
      else:
        end = j
        break
  else:
    continue
  chrlis.append(s[i:j])

ans = 0
for i in range(len(chrlis)):
  tmp = len(chrlis[i])
  if tmp>ans:
    ans = tmp
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = 0
for i in range(1, n+1):
    for j in range(n-i):
        target = S[j:j+i]
        flag = True
        for t in target:
            if t not in ['A', 'C', 'G', 'T']:
                flag = False
                break
            
        if flag:
            ans = max(ans, len(target))

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
#print(s)
count = 0
count_list = [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:
        count_list.append(count)
        count = 0
count_list.append(count)  # 最後の文字がのカウントが追加されていないのでここで追加
print(count_list)
print(max(count_list))

Submission status: Wrong Answer

Solution code:
s = input()
#print(s)
count = 0
count_list = [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:
        count_list.append(count)
        count = 0
#print(count_list)
print(max(count_list))

Submission status: Wrong Answer

Solution code:
s = input()
#print(s)
count = 0
count_list =[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:
        count_list.append(count)
        count = 0
#print(count_list)
print(max(count_list))

Submission status: Wrong Answer

Solution code:
import re
S = input()
S = re.sub("[ACGT]", "*", S)
cnt = 0
for i in range(len(S)):
    for j in range(i, len(S)):
        if S[i:j] == "*" * (j - i):
            cnt = max(j - i, cnt)
print(cnt)

Submission status: Wrong Answer

Solution code:
S = input()
l = []
ans = ("A", "C", "G", "T")
A = 0
flag = False

for i in range(len(S)):
    for j in range(i+1, len(S)):
        l.append(S[i:j])
    
for i in range(len(l)):
    for c in l[i]:
        if c not in ans:
            flag = True
            break
    if flag:
        flag = False
        continue
    A = max(A, len(l[i]))

print(A)

Submission status: Wrong Answer

Solution code:
# abc122_b.py
s = input()
ans = 0
cnt = 0
for i in s:
    if i == "A" or i=="T" or i=="G" or i=="C" :
        cnt+=1
    else:
        if ans<cnt:
            ans=cnt
            cnt=0
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
n = len(S)
ans = 0
k = 0
agct = ['A','G','C','T']
for i in range(n):
    if S[i] in agct:
        k+=1
        continue
    ans = max(k,ans)
    k = 0

print(ans)

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str,x)))
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
mo = 10**9+7

def main():
	s = IS()
	ans = 0
	cnt = 0
	for ss in s:
		if ss=="A" or ss=="T" or ss=="G" or ss=="C":
			cnt += 1
		else:
			ans = max(ans,cnt)
			cnt=0
	print(ans)


if __name__ == '__main__':
	main()

Submission status: Wrong Answer

Solution code:
moji = str(input())
length = len(moji)
mojilst = list(moji)
ans = 0
count = 0
temp = []
for i in range(length):
  if str(mojilst[i]) == "A" or str(mojilst[i]) == "G" or str(mojilst[i]) == "C" or str(mojilst[i]) == "T":
    temp.append(str(mojilst[i]))
  else:
    if ans < len(temp):
      ans = len(temp)
    temp = []
    count += 1
if count == 0:
  print(len(temp))
else:
  print(ans)

Submission status: Wrong Answer

Solution code:
moji = str(input())
length = len(moji)
mojilst = list(moji)
ans = 0
temp = []
for i in range(length):
  if str(mojilst[i]) == "A" or str(mojilst[i]) == "G" or str(mojilst[i]) == "C" or str(mojilst[i]) == "T":
    temp.append(str(mojilst[i]))
  else:
    if ans < len(temp):
      ans = len(temp)
    temp = []
print(ans)

Submission status: Wrong Answer

Solution code:
moji = str(input())
length = len(moji)
mojilst = list(moji)
ans = []
temp = []
for i in range(length):
  if mojilst[i] == "A" or mojilst[i] == "G" or mojilst[i] == "C" or mojilst[i] == "T":
    temp.append(str(mojilst[i]))
  else:
    if len(ans) < len(temp):
      ans = temp
    temp = []
print(len(ans))

Submission status: Wrong Answer

Solution code:
s = input()
count = 0
acgt = "ACGT"
temp = 0
for i in range(len(s)):
  if s[i] in acgt:
    temp += 1
  elif temp:
    if count < temp:
      count = temp
    temp = 0
print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(len(s)):
    if s[i] in ACGT:
        ans += 1
    else:
        ANS.append(ans)
        ans = 0
        
print(max(ANS))

Submission status: Wrong Answer

Solution code:
S = list(input())

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

print(res)

Submission status: Wrong Answer

Solution code:
s=input()
n=int(len(s))
count=0
man=0
for i in range(n-1):
  if s[i]=='A' or s[i]=='T' or s[i]=='G' or s[i]=='C':
    count+=1
    if count!=0:
      man=count
  else:
    count=0
    
if man>=count:
  print(man)
elif count==1:
  print('0')
else:
  print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S=input()
s=[str(c) for c in(S)]
M=0
a=0
for i in range(len(s)):
  if s[i]=='A' or s[i]=='G' or s[i]=='C' or s[i]=='T':
    a+=1
  else:
    if M<a:
      M=a
    a=0
print(M)

Submission status: Wrong Answer

Solution code:
s=list(map(str,input().split()))
M=0
a=0
for i in range(len(s)):
  if s[i]=='A' or s[i]=='G' or s[i]=='C' or s[i]=='T':
    a+=1
  else:
    if M<a:
      M=a
    a=0
print(M)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()

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

Submission status: Wrong Answer

Solution code:
def myAnswer(S:str) -> int:
   ans = 0
   a=[chr(i) for i in range(65, 65+26)]
   a.remove("A")
   a.remove("T")
   a.remove("C")
   a.remove("G")
   counter = 0
   for s in S:
      if((s in a) == False):
         counter +=1
      else:
         ans=max(counter,ans)
         counter=0
   return ans


def modelAnswer():
   tmp=1
def main():
   S = input()
   print(myAnswer(S))

if __name__ == '__main__':
   main()

Submission status: Wrong Answer

Solution code:
string_data = list(input())

N = len(string_data)
match_word_lits = ['A', 'C', 'G', 'T']
count = 0
max_word = 0
for i in range(N):
    if string_data[i] in match_word_lits:
        count += 1
    else:
        if max_word < count:
            max_word = count
        count = 0

print(max_word)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline # 改行コード「\n」を呼んでしまうため、文字数など、注意！！

s = input().replace("\n","")

ans = 0

for i in range(len(s)):
    cnt = 0
    for j in range(i,len(s)):
        print(len(s),i)
        print(s[j:])
        print(s[j])
        if s[j] == 'A' or s[j] == 'C' or s[j] == 'G' or s[j] == 'T':
            cnt += 1
            if cnt > ans:
                ans = cnt
        else:
            print("AGCT意外です。カウント数：",cnt)
            break

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline # 改行コード「\n」を呼んでしまうため、文字数など、注意！！

s = input().replace("\n","")

ans = 0

for i in range(len(s)):
    cnt = 0
    for j in range(i,len(s)-i):
        # print(s[j])
        if s[j] == 'A' or s[j] == 'C' or s[j] == 'G' or s[j] == 'T':
            cnt += 1
            if cnt > ans:
                ans = cnt
        else:
            break

print(ans)

Submission status: Wrong Answer

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

ans = 0
cnt = 0
suffix = 0

while suffix < len(s):
    if s[suffix] in acgt:
        cnt += 1
    else:
        ans = max(ans, cnt)
        cnt = 0
    suffix += 1
print(ans)

Submission status: Wrong Answer

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

ans = 0
cnt = 0
suffix = 0

while suffix < len(s):
    if s[suffix] in acgt:
        cnt += 1
    else:
        ans = max(ans, cnt)
        cnt = 0
    suffix += 1
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()

ans = 0
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:
#python3

def main():
    s = input()
    n = len(s)
    ans = 0
    cnt = 0 
    for i in range(n-1):
        if not ((s[i] == 'A') or (s[i] == 'T') or (s[i] == 'C') or (s[i] == 'G')):
            cnt = 0
        else:
            cnt += 1
        ans = max(cnt, ans)
    print(ans)
main()

Submission status: Wrong Answer

Solution code:
ans=0
for i in list(input()):
    if i in {"A","G","C","T"}:ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
ans = 0
for i in range(len(S)):
    for j in range(i,len(S)):
        print(S[i:j+1])
        flag = True
        for k in S[i:j+1]:
            if not (k=='A' or k=='C' or k=='G' or k=='T'):
                flag = False
                break
        if flag:
            ans = max(ans, len(S[i:j+1]))
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
ans = 0
for i in range(len(S)):
    for j in range(i+1,len(S)):
        flag = True
        for k in S[i:j+1]:
            if not (k=='A' or k=='C' or k=='G' or k=='T'):
                flag = False
                break
        if flag:
            ans = max(ans, len(S[i:j+1]))
print(ans)

Submission status: Wrong Answer

Solution code:
s = str(input())
s += "B"
l = len(s)
c = 0
mx = 0
for i in range(l):
  if s[i] in ["A","G","C","T"]:
    c += 1
  else:
    if c > mx:
      mx = c
      c = 0
    else:
      c = 0

Submission status: Wrong Answer

Solution code:
S = input()
ans = 0
for i in range(len(S)):
    for j in range(i,len(S)):
        s = S[i:j]
        if sum([s.count(x) for x in 'ACGT']) == len(s):
            ans = max(ans, len(s))

print(ans)

Submission status: Wrong Answer

Solution code:
def hantei(n):
    for i in range(len(n)):
        if n[i]!="A" and n[i]!="G" and n[i]!="T" and n[i]!="C":
            return False

s=input()
T=[]
n=[]
m=[]
x=0

for i in range(len(s)-1):
    for j in range(i+1,len(s)):
        T.append(s[i:j+1])

flag=False
for i in range(len(T)):
    w=T[i]
    if hantei(w)!=False:
        n.append(w)

for i in range(len(n)):
    m.append(len(n[i]))

if not m:
    print(0)
else:
    print(max(m))

Submission status: Wrong Answer

Solution code:
def hantei(n):
    for i in range(len(n)):
        if n[i]!="A" and n[i]!="G" and n[i]!="T" and n[i]!="C":
            return False

s=input()
T=[]
n=[]
m=[]
x=0

for i in range(len(s)-1):
    for j in range(i+1,len(s)):
        T.append(s[i:j+1])

flag=False
for i in range(len(T)):
    w=T[i]
    if hantei(w)!=False:
        n.append(w)

for i in range(len(n)):
    m.append(len(n[i]))

if not m:
    print(0)
else:
    print(m)
    print(n)

Submission status: Wrong Answer

Solution code:
S = list(input())

cnt=0
ans=0
for x in S:
    if x=="A" or x=="C" or x=="G" or x=="T":
        cnt+=1
    else:
        if ans < cnt:
            ans = cnt

        cnt=0

print(ans)

Submission status: Wrong Answer

Solution code:
S = str(input())
ans = 0
for i in range(len(S)):
    count = 0
    fr = 0
    if S[i] == "A" or S[i]=="T" or S[i]=="C" or S[i]=="G":
        count += 1
        for j in range(i+1, len(S)):
            if fr == 0 and S[j] == "A"  or  S[j] == "T"  or  S[j] == "C"  or  S[j] == "G":  
                count += 1
            else:
                fr += 1
    if count ==2 and S[i] =="A" and S[i+1]=="C":
        count = 0
    if count == 1:
        count = 0
    if ans < count:
        ans = count
print(ans)

Submission status: Wrong Answer

Solution code:
S = str(input())
ans = 0
for i in range(len(S)):
    count = 0
    fr = 0
    if S[i] == "A" or S[i]=="T" or S[i]=="C" or S[i]=="G":
        count += 1
        for j in range(i+1, len(S)):
            if fr == 0 and S[j] == "A"  or  S[j] == "T"  or  S[j] == "C"  or  S[j] == "G":  
                count += 1
            else:
                fr += 1
    if count ==2 and S[i] =="A" and S[i+1]=="C":
        count = 0
    if ans < count:
        ans = count
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()

max = 0
for i in range(len(S)-1):
    for j in range(i+1, len(S)+1):
        count = 0
        for char in S[i:j]:
            if char == 'A' or char == 'C' or char == 'G' or char == 'T':
                count += 1
            else:
                count = 0
                break
        if count > max:
            max = count

print(max)

Submission status: Wrong Answer

Solution code:
S = input()

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

print(max)

Submission status: Wrong Answer

Solution code:
S = input()

max = 0
for i in range(len(S)-1):
    for j in range(i+1, len(S)):
        count = 0
        for char in S[i:j]:
            if char == 'A' or char == 'C' or char == 'G' or char == 'T':
                count += 1
            else:
                count = 0
                break
        if count > max:
            max = count

print(max)

Submission status: Wrong Answer

Solution code:
S = input()

max = 0
for i in range(len(S)-1):
    for j in range(i+1, len(S)):
        count = 0
        for char in S[i:j]:
            if char == 'A' or char == 'C' or char == 'G' or char == 'T':
                count += 1
        if count > max:
            max = count

print(max)

Submission status: Wrong Answer

Solution code:
S = input()

max = 0
for i in range(len(S)):
    if i + 1 >= len(S):
        break
    for j in range(i+1, len(S)):
        count = 0
        for char in S[i:j]:
            if char == 'A' or char == 'C' or char == 'G' or char == 'T':
                count += 1
        if count > max:
            max = count

print(max)

Submission status: Wrong Answer

Solution code:
S = input()
ans = 0
i = 0
while i<len(S):
    j = 0
    if (S[i+j]=='A' or S[i+j]=='G' or S[i+j]=='T' or S[i+j]=='C'):
        while i+j<len(S) and (S[i+j]=='A' or S[i+j]=='G' or S[i+j]=='T' or S[i+j]=='C'): 
            j +=1
        if j >= ans:
            ans = j
        i = i+j     
    else:
        i += i+1
print(ans)
# print(S)

Submission status: Wrong Answer

Solution code:
s = input()
L = "ACGT"
ans = ""
ss = ""
for i in range(len(s)):
  if s[i] in L:
    ans += s[i]
    #print(ans,ss)
  else:
    if len(ans)>len(ss):
      
      ss = ans
      ans = ""
print(len(ss))

Submission status: Wrong Answer

Solution code:
s = input()
L = "ACGT"
ans = ""
ss = ""
for i in range(len(s)):
  if s[i] in L:
    ans += s[i]
    print(ans,ss)
  else:
    if len(ans)>len(ss):
      
      ss = ans
      ans = ""
print(len(ss))

Submission status: Wrong Answer

Solution code:
s = input()
L = "ACGT"
ans = ""
ss = ""
for i in range(len(s)):
  if s[i] in L:
    ans += s[i]
    flag = True
  else:
    if len(ans)>len(ss):
      ss = ans
      break
print(len(ss))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = input()
check = 'ACGT'
ans_list = []
for p in range(len(a)):
    for q in range(len(a)-1):
        
        count = 0
        for r in range(len(a[p:len(a)-q])):
            
            if a[p:len(a)-q][r] in check:
                count += 1
                if count == len(a[p:len(a)-q]):
                    ans_list.append(a[p:len(a)-q])
                    break
ls =[]
for i in range(len(ans_list)):
    ls.append(len(ans_list[i]))
if len(ls) == 0:
    print(0)
else:
    print(max(ls))

Submission status: Wrong Answer

Solution code:
s = input()

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

ans = 0
ans_max = 0
flg = False
for c in s:
    if c in ACGT:
        ans += 1
        flg = True
    elif flg:
        ans_max = max(ans_max, ans)
        ans = 0
        flg = False

print(ans_max)

Submission status: Wrong Answer

Solution code:
a = input()
check = 'ACGT'
ans_list = []
for p in range(len(a)):
    for q in range(len(a)-1):
        
        count = 0
        for r in range(len(a[p:len(a)-q])):
            
            if a[p:len(a)-q][r] in check:
                count += 1
                if count == len(a[p:len(a)-q]):
                    ans_list.append(a[p:len(a)-q])
                    
                    break
ls =[]
for i in range(len(ans_list)):
    ls.append(len(ans_list[i]))
if len(ls) == 0:
    print(0)
else:
    print(max(ls))

Submission status: Wrong Answer

Solution code:
a = list(input())
ans = []
count = 0
for i in a:

    if i == 'A':
        count +=1
    elif i == 'C':
        count+=1
    elif i == 'G':
        count+=1
    elif i == 'T':
        count+=1
    else:
        ans.append(count)
        count = 0
if len(ans) == 0:
    ans.append(count)
print(max(ans))

Submission status: Wrong Answer

Solution code:
a = list(input())
ans = []
count = 0
for i in range(len(a)):

    if a[i] == 'A':
        count +=1
    elif a[i] == 'C':
        count+=1
    elif a[i] == 'G':
        count+=1
    elif a[i] == 'T':
        count+=1
    else:
        ans.append(count)
        count = 0
if len(ans) == 0:
    ans.append(count)
print(max(ans))

Submission status: Wrong Answer

Solution code:
a = input()
ans = []
count = 0
for i in range(len(a)):

    if a[i] == 'A':
        count +=1
    elif a[i] == 'C':
        count+=1
    elif a[i] == 'G':
        count+=1
    elif a[i] == 'T':
        count+=1
    else:
        ans.append(count)
        count = 0
if len(ans) == 0:
    ans.append(count)
print(max(ans))

Submission status: Wrong Answer

Solution code:
a = input()
ans = []
count = 0
for i in range(len(a)):

    if a[i] == 'A':
        count +=1
    elif a[i] == 'C':
        count+=1
    elif a[i] == 'G':
        count+=1
    elif a[i] == 'T':
        count+=1
    else:
        ans.append(count)
        count = 0
    if len(ans) == 0 and i == len(a)-1:
        ans.append(count)
print(max(ans))

Submission status: Wrong Answer

Solution code:
S = list(input())
agct = ['A','G','C','T']
count = 0
max_count = 0
for key in S:
    if key in agct:
        count += 1
    else:
        max_count = max(max_count,count)
        count = 0
print(max_count)

Submission status: Wrong Answer

Solution code:
# AtCoder Beginner Contest 122
# B - ATCoder
# https://atcoder.jp/contests/abc122/tasks/abc122_b

S = input()
n = len(S)

maxl = 0
for i in range(n):
    for j in range(i+1, n):
        for s in S[i:j+1]:
            if s not in 'ACGT':
                break
        else:
            if maxl < j-i+1:
                maxl = j-i+1

print(maxl)

Submission status: Wrong Answer

Solution code:
s = input()

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

sub = []
for i in range(len(s)-1):
  for j in range(i+1,len(s)):
    tmp = s[i:j]
    flag = True
    for k in range(len(tmp)):
      if tmp[k] in lis:
        pass
      else:
        flag = False
    if flag: sub.append(tmp)
      
ma = 0
for i in sub:
  l = len(i)
  if l > ma: ma = l
print(ma)

Submission status: Wrong Answer

Solution code:
s = input()

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

Submission status: Wrong Answer

Solution code:
s = input()
_s = {"A", "C", "G", "T"}
t = 0
ans = 0
for i in s:
    if i in _s:
        t += 1
    else:
        ans = max(ans, t)
        t = 0
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
ans = 0
length = 0
for i in range(len(s) - 1):
    if s[i] not in {'A', 'C', 'G', 'T'}:
        continue
    length = 1
    for j in range(i + 1, len(s)):
        if s[j] not in {'A', 'C', 'G', 'T'}:
            break
        length += 1
    ans = max(ans, length)
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
ans = 0
for i in range(len(s) - 1):
    if s[i] not in {'A', 'C', 'G', 'T'}:
        continue
    length = 1
    for j in range(i + 1, len(s)):
        if s[j] not in {'A', 'C', 'G', 'T'}:
            break
        length += 1
    ans = max(ans, length)
print(ans)

Submission status: Wrong Answer

Solution code:
S=input()

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

Submission status: Wrong Answer

Solution code:
s = input()
ans = 0
leng = 0
t = ('A','C','G','T')

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