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()
L = len(S)
ans = 0
for i in range(L-1):
    c = 0
    for s in S[i:]:
        if s in ['A', 'C', 'G', 'T']:
            c += 1
        else:
            break
    ans = max(ans, c)

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=input()
tmp, cnt = 0, 0
for i in range(12):
  try:
    if s[i] in {"A", "C", "G", "T"}:
      tmp += 1
    else:
      cnt = max(cnt, tmp)
      tmp = 0
  except:
    print(cnt)
    exit()

Submission status: Wrong Answer

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

count = 0

for i in range(len(l)-1):
    if l[i] == 'A' or l[i] == 'C' or l[i] == 'G' or l[i] == 'T':
        count += 1
        if l[i] == l[i+1]:
            count += 1

print(count)

Submission status: Wrong Answer

Solution code:
def main():
    # n = int(input())
    # n, m = map(int, input().split())
    # a = list(map(int, input().split()))
    s = input()
    # h = [int(input()) for _ in rane(n)]
    count = 0
    maxi = 0
    for string in s:
        if string == "A" or string == "C" or string == "G" or string == "T":
            count += 1
        else:
            maxi= max(count, maxi)
            count = 0

    print(maxi)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
S = list(input())
temp = 0
ans = 0
letter = ["A", "T", "C", "G"]
for i, val in enumerate(S):
  if val in letter:
    temp += 1
  else:
    if ans < temp:
      ans = temp
    temp = 0
print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    # n = int(input())
    # n, m = map(int, input().split())
    # a = list(map(int, input().split()))
    s = input()
    # h = [int(input()) for _ in rane(n)]
    count = 0
    maxi = 0
    for string in s:
        if string == "A" or string == "C" or string == "G" or string == "T":
            count += 1
        else:
            maxi= max(count, maxi)

    print(maxi)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
s = input()
ans = 0
length = 0

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

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()

acgt = ['A', 'C', 'G', 'T']
ans, cnt = 0, 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:
# ABC122
# B ATCoder
# ACGT
S =input()
ct = 0
ctM = [0]
for i in range(len(S)):
    if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
        ct +=1
    else:
        ctM.append(ct)
        ct = 0
print(max(ctM))

Submission status: Wrong Answer

Solution code:
s=input()

tmp=0
length=[]

for i in range(len(s)):
    if s[i]=="A" or s[i]=="C" or s[i]=="G" or s[i]=="T":
        tmp+=1
        if i==len(s)-1:
            length.append(tmp)
    else:
        length.append(tmp)
        tmp=0
print(length)

Submission status: Wrong Answer

Solution code:
import random
b = input()
if b =="A":
    print("T")
elif b=="T":
    print("A")
elif b=="G":
    print("C")
elif b=="C":
    print("G")

Submission status: Wrong Answer

Solution code:
s = input()
if s == 'A':
    print('T')
if s == 'T':
    print('A')
if s == 'G':
    print('C')
if s == 'C':
    print('G')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=input()
ans=0
f=0
preans=0
for i in s:
    if i=="A"or i=="T"or i=="G"or i=="C" :
        if f==0:
            f=1
            preans=1
        else:
            preans+=1
    else:
        ans=max(ans,preans)
        f=0
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)+1):
    t = s[i:j].replace('A','')
    t = t.replace('C','')
    t = t.replace('G','')
    t = t.replace('T','')
    if t == '':
      ans = max(j-i,ans)
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)):
    t = s[i:j].replace('A','')
    t = t.replace('C','')
    t = t.replace('G','')
    t = t.replace('T','')
    if t == '':
      ans = max(j-i,ans)
print(ans)

Submission status: Wrong Answer

Solution code:
S = 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()
i = 0
result = []
for a in S:
  if a == "A" or a == "C" or a == "G" or a == "T":
    i += 1
  else:
    result.append(i)
    i = 0


if len(result) == 0:
  print(i)
else:
  result.sort()
  print(result[-1])

Submission status: Wrong Answer

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

def II(): return int(input())
def MII(): return map(int, input().split())
def LII(): return list(map(int, input().split()))

def main():
    S = input()

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

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
s = input()
l = len(s)
ans = 0
for i in range(l-1):
    for j in range(i+1, l+1):
        for ss in s[i:j]:
            if ss not in 'ACGT':
                break
        else:
            ans = max(ans, len(s[i:j]))
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
l = len(s)
ans = 0
for i in range(l-1):
    for j in range(i+1, l):
        for ss in s[i:j]:
            if ss not in 'ACGT':
                break
        else:
            ans = max(ans, len(s[i:j]))
print(ans)

Submission status: Wrong Answer

Solution code:
S=input()
l=len(S)
x=['A','C','G','T']
a=0
m=0
for i in range(l):
    if S[i] in x:
        a+=1
    else:
        if a>m:
            m=a
        a=0
print(m)

Submission status: Wrong Answer

Solution code:
S = input()
count = 0
koremade = 0
for i in range(0,len(S)):
    if S[i] in 'ACGT':
        count += 1
    else:
        if koremade <= count:
            koremade = count
        count = 0
print(koremade)

Submission status: Wrong Answer

Solution code:
S = input()
cnt = 0
cntmax = 0
for i in range(len(S)):
    if S[i] == "A" or S[i] == "T" or S[i] == "G" or S[i] == "C":
        cnt+=1
        if cnt>cntmax:
            cntmax = cnt

print(cntmax)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=list(input())

l=[]
cnt=0

for i in s:
  if i=='A' or i=='C' or i=='G' or i=='T':
    cnt+=1
  else:
    if cnt!=0:
      l.append(cnt)
    cnt=0

if not l:
  print('0')
else:
  print(max(l))

Submission status: Wrong Answer

Solution code:
s=list(input())

l=[]
cnt=0

for i in s:
  if i=='A' or i=='C' or i=='G' or i=='T':
    cnt+=1
  else:
    if cnt!=0:
      l.append(cnt)
      cnt=0

if not l:
  print('0')
else:
  print(max(l))

Submission status: Wrong Answer

Solution code:
import re
pattern = re.compile('[ACGT]+')
S = input()
print(re.findall(pattern, S))
print(len(max(re.findall(pattern, S), key=len, default='')))

Submission status: Wrong Answer

Solution code:
import re
pattern = re.compile('[ACGT]+')
S = input()
print(len(max(re.findall(pattern, S), default='')))

Submission status: Wrong Answer

Solution code:
import re
pattern = re.compile('[ACGT]+')
S = input()
print(len(max(re.findall(pattern, S), default='')))

Submission status: Wrong Answer

Solution code:
s = str(input())

ans = 0
memo = 0

for i in range(len(s)):
    if s[i] != "A" and s[i] !="C" and s[i] != "G" and s[i] !="T":
        if i-memo > ans:
            ans = i-memo
        memo = i+1
        #print(memo, ans, i)

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
acgt = 'ACGT'
max_count = 0
for i in range(len(s)):
    count = 0
    if s[i] not in acgt:
        continue
    count += 1
    for j in range(i+1, len(s)):
        if s[j] in acgt:
            count += 1
        else:
            if count > max_count:
                max_count = count
            i = j+1
            break
print(max_count)

Submission status: Wrong Answer

Solution code:
a=input()
b=0
c=0
for i in range(len(a)):
  if a[i]=="A" or a[i]=="C" or a[i]=="G" or a[i]=="T":
    b=b+1
  if a[i]!="A" and a[i]!="C" or a[i]!="G" or a[i]!="T":
    b=0
  if c<b:
    c=b
print(c)

Submission status: Wrong Answer

Solution code:
s =  list(input())
combo = False
cnt = 0
ans = [0,] 
for mozi in s:
    if(mozi == "A" or mozi == "G" or mozi == "C" or mozi == "T"):
        cnt = cnt + 1 
        if combo != True:
            combo = True
    elif combo:
        ans.append(cnt)
        cnt = 0
        combo = False
print(max(ans))

Submission status: Wrong Answer

Solution code:
s =  list(input())
combo = False
ans = []
for mozi in s:
    if(mozi == "A" or mozi == "G" or mozi == "C" or mozi == "T"):
        ans.append(mozi)
        if combo != True:
            combo = True
    else:
        if combo:
            break
        else:
            continue
print(len(ans))

Submission status: Wrong Answer

Solution code:
s =  list(input())
combo = False

ans = []
for mozi in s:
    if(mozi == "A" or mozi == "G" or mozi == "C" or mozi == "T"):
        ans.append(mozi)
        if combo != True:
            combo = True
            
    elif combo:
        break
print(len(ans))

Submission status: Wrong Answer

Solution code:
s =  list(input())
ans = []
for mozi in s:
    if(mozi == "A" or mozi == "G" or mozi == "C" or mozi == "T"):
        ans.append(mozi)
    else:
        break
print("".join(ans))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
s = input()

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

ans = 0
for i in s:
    if i in t:
        ans +=1 
print(ans)

Submission status: Wrong Answer

Solution code:
s=input()
print(s.count('A')+s.count('T')+s.count('G')+s.count('C'))

Submission status: Wrong Answer

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

for i in s:
    if i in a:
        c += 1
    else:
        ans += [c]
        c = 0
if ans == []:
    print(len(s))
else:
    print(max(ans))

Submission status: Wrong Answer

Solution code:
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

s = s()

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

Submission status: Wrong Answer

Solution code:
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

s = s()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print (ans)

Submission status: Wrong Answer

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

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

print (ans)

Submission status: Wrong Answer

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

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

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)):
        tmp = s[i:j]
        if set(list(tmp)) <= set(["A","C","G","T"]):
            ans = max(ans,len(tmp))
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)):
        tmp = s[i:j]
        if len(set(list(tmp))|set(["A","C","G","T"])) <= 4:
            ans = max(ans,len(tmp))
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = list(input())
ACGT = ["A", "C", "G", "T"]
count = 0
Max = 0
if len(S) == 1:
    if  S in ACGT:
        print(1)
    else:
        print(0)
else:
    for s in S:
        if s in ACGT:
            count += 1
            if count > Max:
                Max = count
        else:
            if count > Max:
                Max = count
            count = 0
    print(Max)

Submission status: Wrong Answer

Solution code:
S=str(input())
S2=[]
ans=0
for i in range(len(S)):
  for j in range(len(S)+1):
    S2=S[i:j]
    print(S2)
    que=len(S2)
    S2=S2.replace("A","")
    S2=S2.replace("G","")
    S2=S2.replace("C","")
    S2=S2.replace("T","")
    if S2=="":
      if que>ans:
        ans=que
    S2=[] 
print(ans)

Submission status: Wrong Answer

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

start = False
counts = [0]

for i, c in enumerate(S):
	if c in l:
		if start == False:
			start = True
			count = 1
		else:
			count += 1
			if i == len(S) - 1:
				counts.append(count)
	else:
		if start == False:
			continue
		else:
			start = False
			counts.append(count)
			count = 0

print(max(counts))

Submission status: Wrong Answer

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

start = False
counts = [0]
for c in S:
	if c in l:
		if start == False:
			start = True
			count = 1
		else:
			count += 1
	else:
		if start == False:
			continue
		else:
			start = False
			counts.append(count)
			count = 0
		
print(max(counts))

Submission status: Wrong Answer

Solution code:
S = list(input())
ACGT = ["A", "C", "G", "T"]
count = 0
Max = 0
if len(S) == 1:
    if  S in ACGT:
        print(1)
else:
    for s in S:
        if s in ACGT:
            count += 1
            if count > Max:
                Max = count
        else:
            if count > Max:
                Max = count
            count = 0
    print(Max)

Submission status: Wrong Answer

Solution code:
S = list(input())
ACGT = ["A", "C", "G", "T"]
count = 0
Max = 0
for s in S:
    if s in ACGT:
        count += 1
    else:
        if count > Max:
            Max = count
        count = 0
print(Max)

Submission status: Wrong Answer

Solution code:
a=input()
total=0
total2=0
i=0
while True:
    if i==len(a)-1:
        break
    elif a[i]=="A" or a[i]=="T" or a[i]=="C" or a[i]=="G":
        total+=1
        i+=1
    else:
        i+=1
        if total2<total:
            total2=total
        total=0
if total2<total:
    print(total)
else:
    print(total2)

Submission status: Wrong Answer

Solution code:
a=input()
total=0
total2=0
i=0
while True:
    if i==len(a)-1:
        break
    elif a[i]=="A" or a[i]=="T" or a[i]=="C" or a[i]=="G":
        total+=1
        i+=1
    else:
        i+=1
        if total2<total:
            total2=total
        total=0
print(total2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()

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

count_list = [0]
count = 0
max_count = 0
for s in S:
    if s in ACGT:
        count += 1
    else:
        count_list.append(count)
        # max_count = max(max_count, count)
        count = 0
print(max(count_list))

Submission status: Wrong Answer

Solution code:
S = input()

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

count = 0
max_count = 0
for s in S:
    if s in ACGT:
        count += 1
    else:
        max_count = max(max_count, count)
        count = 0
print(max_count)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

s = input().strip()

ans = 0
tmp = 0
for v in s:
    if v in ('A', 'C', 'G', 'T'):
        tmp += 1
    else:
        ans = max(ans, tmp)
        tmp = 0

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

resolve()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
def main():
    S = input()

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import numpy as np
import math
sys.setrecursionlimit(10**6)
def S(): return sys.stdin.readline().rstrip()
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())

def solve():
    key = {"A","C","G","T"}
    mx = 0
    count = 0
    for item in s:
        if item in key:
            count += 1
        else:
            mx = max(mx,count)
            count = 0
    print(mx)
    return

if __name__=='__main__':
    s = S()
    solve()

Submission status: Wrong Answer

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

print(ans if flg==0 else tmp)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
max_len = 0
tmp = 0

S = input()
atcg = ['A', 'T', 'C', 'G']

for i in range(len(S)):
    if S[i] in atcg:
        tmp += 1
    else:
        max_len = max(max_len, tmp)
        tmp = 0

print(max_len)

Submission status: Wrong Answer

Solution code:
b=list(str(input()))
E={"A","C","G","T"}
count=0
ans=0
for moji in b:
	if moji in E:
		count+=1
	else:
		ans=max(ans,count)
		count=0
print(ans)

Submission status: Wrong Answer

Solution code:
b=list(str(input()))
E={"A":"T","T":"A","C":"G","G":"C"}
count=0
ans=0
for moji in b:
	if moji in E:
		count+=1
	else:
		ans=max(ans,count)
		count=0
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)):
        t = s[i:j]
        if (all(map(lambda x:x in ['A','C','G','T'],t))):
            ans = max(len(t),ans)
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()

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

Submission status: Wrong Answer

Solution code:
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

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

ls = len(S)
count = 0
ans = 0
for i in range(ls):
      if S[i] == 'A' or S[i] == 'T' or S[i] == 'G' or S[i] == 'C':
          count += 1
      else:
         if count >= ans:
            ans = count
            count = 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,n):
        if all("ACGT".count(c)==1 for c in s[i:j]):
            ans = max(ans,j-i)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S=input()

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

max_length = 0
length = 0
for word in S:
    if word in acgt:
        length+=1
    else:
        if length!=0:
            if max_length<length:
                max_length=length
            length=0
print(max_length)

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
import numba
from numba import jit

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

@jit
def main(s):
  ans = 0
  for j, i in enumerate(s):
    print(i)
    if i=='A' or i=='C' or i=='G' or i=='T':
      cnt = 1
      j += 1
      while s[j]=='A' or s[j]=='C' or s[j]=='G' or s[j]=='T':
        j += 1
        cnt += 1
      ans = max(ans, cnt)
  return ans
        
s = str(readline().split())
print(main(s))

Submission status: Wrong Answer

Solution code:
l=input()

if "A" or "G" or "C" or "T" in l:
  ans=0
  num=0
  for i in l:
    if i=="A" or i=="G" or i=="C" or i=="T":
      num+=1
      if num==len(l):
        print(num)
    else:
      ans=max(num,ans)
      num=0
    
  print(ans)
else:
  print(0)

Submission status: Wrong Answer

Solution code:
l=input()

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

Submission status: Wrong Answer

Solution code:
l=input()

if "A" or "G" or "C" or "T" not in l:
  print(0)
  exit()

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

Submission status: Wrong Answer

Solution code:
l=input()

if "A" or "G" or "C" or "T" not in l:
  print(0)
  exit()

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

Submission status: Wrong Answer

Solution code:
l=input()

ans=0
num=0

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

Submission status: Wrong Answer

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

for i in range(len(S)):
    if S[i] in ACGT:
        cnt = 1
        for j in range(len(S) - i - 1):
            if S[i+j+1] in ACGT:
                cnt += 1
            else:
                ans[i] = cnt
                break

print(max(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(ans,cnt)
    cnt=0
print(ans)

Submission status: Wrong Answer

Solution code:
#
# abc122 b
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """ATCODER"""
        output = """3"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """HATAGAYA"""
        output = """5"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """SHINJUKU"""
        output = """0"""
        self.assertIO(input, output)


def resolve():
    S = input()

    ans = 0
#    for i in range(len(S)):
#        t = 0
#        if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
#            t += 1
#            for j in range(i+1, len(S)):
#                if S[j] == "A" or S[j] == "C" or S[j] == "G" or S[j] == "T":
#                    t += 1
#                else:
#                    break
#        ans = max(ans, t)

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


if __name__ == "__main__":
    # unittest.main()
    resolve()

Submission status: Wrong Answer

Solution code:
import itertools

S = list(input())
Idxs = list(itertools.combinations(range(len(S)), 2)) 

def ACGT(Word):
    for w in Word:
        if w not in ["A", "C", "G", "T"]:
            return 0
    return len(Word)

ans = 0

for s in S:
    if s in ["A", "C", "G", "T"]:
        ans = 1
        break


for idx in Idxs:
    tmp = S[idx[0]:idx[1]]
    ans = max(ans, ACGT(tmp))
    
print(ans)

Submission status: Wrong Answer

Solution code:
import itertools

S = list(input())
Idxs = list(itertools.combinations(range(len(S)), 2)) 

def ACGT(Word):
    for w in Word:
        if w not in ["A", "C", "G", "T"]:
            return 0
    return len(Word)

ans = 0
for idx in Idxs:
    tmp = S[idx[0]:idx[1]]
    ans = max(ans, ACGT(tmp))
    
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()

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


max_l = 0

for i in range(len(S)):
    l = 0
    for j in range(i, len(S)):
        if S[j] in acgt:
            l+=1
        else:
            continue
    if l > max_l:
        max_l = l
print (max_l)

Submission status: Wrong Answer

Solution code:
S = input()

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


max_l = 0

for i in range(len(S)):
    if S[i] in acgt:
        l = 1
        for j in range(i+1, len(S)):
            if S[j] in acgt:
                l+=1
            else:
                continue
        if l > max_l:
            max_l = l
print (max_l)