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: Runtime Error

Solution code:
# ABC122 B - ATCoder

S=str(input())
AC = 'ATGC'
N = []
for i in range(len(S)):
    if S[i] not in AC:
        N.append(i)
M = N[0]
if M ==0:
    print(int('0'))
    exit()
for j in range(len(N)-1):
    M = max( N[j+1] - N[j],M)
print(M)

Submission status: Runtime Error

Solution code:
1 S = input()
2 N = len(S)
3 ans = 0
4 for i in range(N):
5 for j in range(i, N):
6 if all('ACGT'.count(c) == 1 for c in S[i : j + 1]):
7 ans = max(ans, j - i + 1)

Submission status: Runtime Error

Solution code:
s = list(input())
acgt = ['A', 'C', 'G', 'T']
cnt = 0
i, j = 0, 0
maxv = -1

for j in range(len(s)):
  maxv = max(maxv, cnt)
  cnt = 0
  i = j
  while s[i] in acgt:
    cnt += 1
    i += 1
maxv = max(maxv, cnt)
print(maxv)

Submission status: Runtime Error

Solution code:
s = list(input())
acgt = ['A', 'C', 'G', 'T']
cnt = 0
i, j = 0, 0
maxv = 0

for j in range(len(s)):
  maxv = max(maxv, cnt)
  cnt = 0
  i = j
  while s[i] in acgt:
    cnt += 1
    i += 1
maxv = max(maxv, cnt)
print(maxv)

Submission status: Runtime Error

Solution code:
s = list(input())
acgt = ['A', 'C', 'G', 'T']
cnt = 0
i, j = 0, 0
maxv = 0

for j in range(len(s)):
  maxv = max(maxv, cnt)
  cnt = 0
  while s[j] in acgt:
    cnt += 1
    j += 1
maxv = max(maxv, cnt)
print(maxv)

Submission status: Runtime Error

Solution code:
S = input()
a = 0
count=[]

for i in range(len(S)):
  if S[i] in ["A", "C", "G", "T"]:
    a += 1
    count.append(a)
  else:
    a = 0
print(max(list(map(int, count))))

Submission status: Runtime Error

Solution code:
s = str(input())
ls = ["A","G","T","C"]
di = []
for i in range(len(s)):
    k = 0
    for j in range(len(s)-i):
        if s[i+j] in ls:
            k += 1
        else:
            di.append(k)
            k = 0
print(max(di))

Submission status: Runtime Error

Solution code:
s = list(input())
N = len(s)

ref = ["A","C","G","T"]
lst = []

for i in range(N):
    ans = ""
    if s[i] in ref:
        while s[i] in ref:
            ans = ans + s[i]
            i += 1
    lst.append(ans)

ans = -float("inf")
for i in range(N):
    ans = max(ans, len(lst[i]))

print(ans)

Submission status: Runtime Error

Solution code:
S = [i for i in input()]
k = ['A', 'C', 'G', 'T']
count_res = []
count = 0
for i in S:
    if i in k:
        count = count + 1
    else:
        count_res.append(count)
        count = 0
count_res.sort()
print(count_res[-1])

Submission status: Runtime Error

Solution code:
s = input()

for n in range(len(s)):
  if s[n] == "A" or s[n] == "C" or s[n] == "G" or s[n] == "T":
    break
  else:
    continue
for m in range(n+1,len(s)):
  if s[m] == "A" or s[m] == "C" or s[m] == "G" or s[m] == "T":
    continue
  else:
    break
print(len(s[n:m]))

Submission status: Runtime Error

Solution code:
S = input()

c = 0
l = []
for i in range(len(S)):
    if S[i] == "A" or S[i] == "C" :
        c += 1
    elif S[i] == "G" or S[i] == "T" :
        c += 1
    else :
        l.append(c)
        c = 0

print(max(l))

Submission status: Runtime Error

Solution code:
s = input()
cnt = 0
ACGT = {"A", "C", "G", "T"}
ANS = []
for i in s:
    if i in ACGT:
        cnt += 1
    elif i not in ACGT:
        ANS.append(cnt)
        cnt = 0
print(max(ANS))

Submission status: Runtime Error

Solution code:
import sys
import re
S = input()
if not ( 1 <= len(S) <= 10 ): sys.exit()
if not S.isupper: sys.exit()

max = max(re.findall('[A|T|G|C]+', S)) if re.findall('[A|T|G|C]+', S) else 0
if max > 0:max
print(max)

Submission status: Runtime Error

Solution code:
import sys
import re
S = input()
if not ( 1 <= len(S) <= 10 ): sys.exit()
if not S.isupper: sys.exit()

print(len(max(re.findall('[A|T|G|C]+', S))))

Submission status: Runtime Error

Solution code:
S = input()

ACGT = ['A', 'C', 'G', 'T']
cntList = []
cnt = 0
for s in S:
    if s in ACGT:
        cnt += 1
        cntList.append(cnt)
    else:
        cnt = 0
print(max(cntList))

Submission status: Runtime Error

Solution code:
S = input()

ACGT = ['A', 'C', 'G', 'T']
cntList = []
cnt = 0
for s in S:
    if s in ACGT:
        cnt += 1
    else:
        cntList.append(cnt)
        cnt = 0
if max == []:
    print(0)
    quit()
print(max(cntList))

Submission status: Runtime Error

Solution code:
S = input()

ACGT = ['A', 'C', 'G', 'T']
cntList = []
cnt = 0
for s in S:
    if s in ACGT:
        cnt += 1
    else:
        cntList.append(cnt)
        cnt = 0

print(max(cntList))

Submission status: Runtime Error

Solution code:
S = input()

AGCT = 'AGCT'

count = []
tmp_num = 0
for i in S:
    if i in AGCT:
        tmp_num += 1
    else:
        count.append(tmp_num)
        tmp_num = 0

print(max(count))

Submission status: Runtime Error

Solution code:
S = input()
max = 0
count = 0
for x in S :
    if x in "ATGC" :
        count += 1
    else :
        max = max(max, count)
        count = 0
max = max(max, count)
print(max)

Submission status: Runtime Error

Solution code:
S = input()
counts = []
count = 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:
    counts.append(count)
    count = 0
print(max(counts))

Submission status: Runtime Error

Solution code:
S=input()

l=len(S)

ans=0
ans_list=()

for i in range(l):
    if S[i] in ("A","G","C","T"):
        ans+=1
    else:
        ans_list.append(ans)
        ans=0
ans_list.append(ans)
print(ans)

Submission status: Runtime Error

Solution code:
S=list(str(input()))
A=["A","T","G","C"]
#print(S)
cnt=0
ans=[]
for (i,s) in enumerate(S):
    if s in A:
        cnt+=1
    else:
        ans.append(cnt)
        cnt=0
print(max(ans))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S = input()

AGCT = ['A','G','C','T']
AGCT_list = []

i = 0
while i < len(S):
    #print('i=',i)
    if S[i] in AGCT:
        k = 1
        agct_tmp = S[i]
        while S[i+k] in AGCT:
            #print('k=', k)
            #print('i+k=',i+k)
            agct_tmp += S[i+k]
            if i+k+1 < len(S):
                k +=1
            else:
                break
    
        AGCT_list.append(agct_tmp)
        i = i + k + 1
    else:
        i += 1
if AGCT_list:
    print(max([len(string) for string in AGCT_list]))
else:
    print('0')

Submission status: Runtime Error

Solution code:
S = input()

AGCT = ['A','G','C','T']
AGCT_list = []

i = 0
while i < len(S):
    print('i=',i)
    if S[i] in AGCT:
        k = 1
        agct_tmp = S[i]
        while S[i+k] in AGCT:
            print('k=', k)
            print('i+k=',i+k)
            agct_tmp += S[i+k]
            if i+k+1 < len(S):
                k +=1
            else:
                break
    
        AGCT_list.append(agct_tmp)
        i = i + k + 1
    else:
        i += 1
if AGCT_list:
    print(max([len(string) for string in AGCT_list]))
else:
    print('0')

Submission status: Runtime Error

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

Submission status: Runtime Error

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

ans = [0]
for i in range(len(S)):
    if S[i] in l:
        res += 1
    elif res != 0:
        ans.append(res)
        res = 0

print(max(ans))

Submission status: Runtime Error

Solution code:
s = input()
l = []
cnt = 0
for c in s:
    if c == 'A' or c =='C' or c == 'G' or c == 'T':
        cnt += 1
    else:
        l.append(cnt)
        cnt = 0

print(max(l))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import re
sin = input()
match = re.findall(r'[ACTG]+',sin)
m_len = [len(m) for m in match]
print(max(m_len))

Submission status: Runtime Error

Solution code:
S = input()
ATCODER = ['A','C','G','T']
left=0
right=len(S)-1

if len(S)==1:
    if S[i] in ATCODER:
        result = 1
    else:
        result = 0
else:

    for i in range(len(S)//2):
        if not S[i] in ATCODER:
            left = i+1
        if not S[len(S)-1-i] in ATCODER:
            right = len(S)-2-i

    if len(S)%2 ==1:
        if not S[len(S)//2 + 1] in ATCODER:
            if (len(S)//2 + 1) -left <= right - (len(S)//2 + 1):
                left = len(S)//2 + 2
            else:
                right = len(S)//2 - 1

    result = right -left + 1

print(result)

Submission status: Runtime Error

Solution code:
S = input()
ATCODER = ['A','C','G','T']
left=0
right=len(S)-1
for i in range(len(S)//2):
    if not S[i] in ATCODER:
        left = i+1
    if not S[len(S)-1-i] in ATCODER:
        right = len(S)-2-i

if len(S)%2 ==1:
    if not S[len(S)//2 + 1] in ATCODER:
        if (len(S)//2 + 1) -left <= right - (len(S)//2 + 1):
            left = len(S)//2 + 2
        else:
            right = len(S)//2 - 1

result = right -left + 1

print(result)

Submission status: Runtime Error

Solution code:
ss=['A','G','C','T']
s=list(input())
ans=0
for i in range(len(s)-1):
  if s[i] in ss:
    j=i
    cnt=0
    while s[j] in ss:
      j+=1
      cnt+=1
      
    ans=max(ans,cnt)
      
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())

if n == "A":
    print("T")
elif n == "T":
    print("A")
elif n == "C":
    print("G")
else:
    print("C")

Submission status: Runtime Error

Solution code:
n = int(input())
l = list(map(int,input().split()))
l.sort(reverse = True)

if l[0] < sum(l[1:n]):
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
s = input()

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

print(max(cnt))

Submission status: Runtime Error

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

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

for i in range(N):
    if S[i] in ACGT:
        tmp += 1
    else:
        X.append(tmp)
        tmp = 0

print(max(X))

Submission status: Runtime Error

Solution code:
S = input()
T = "ACGT"
ans = 0

i = 0
while i < len(S):
    if S[i] in T:
        temp = 1
        for j in range(i+1, len(S)):
            if S[j] in T:
                temp += 1
            else:
                break
        ans = max(ans, temp)
        i = max(i+1, j+1)
    else:
        i += 1

print(ans)

Submission status: Runtime Error

Solution code:
def main():
    s = input()
    max_len = 0
    length = 0

    for i in list(s).append(''):
        if i in ['A', 'C', 'G', 'T']:
            length += 1
        else:
            if length > max_len:
                max_len = length
                length = 0


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
s=list(input())
n=len(s)
ans=[]
for i in range(n-1):
  for j in range(i+1,n+1):
    part=set(s[i:j])
    flag=True
    for p in part:
      if p not in list('ATGC'):
        flag=False
        break
    if flag==True:
      ans.append(len(part))
print(max(ans))

Submission status: Runtime Error

Solution code:
def main():
    ans = []
    s = input()
    count = 0
    for i in s:
        if i in "ATGC":
            count += 1
        else:
            ans.append(count)
    print(max(ans))
        
if __name__ == "__main__":
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

res=0
for i in range(n):
  for j in range(i,n):
    sub=s[i:j+1]
    flg=True
    for k in sub:
      if(k not in ['A','G','C','T']):
        flg=False
    if(flg):
      res=max(res,len(sub))
      
print(res)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S = list(input())
F = ["A", "C", "G", "T"]
count = 0
max = 0
for i in S:
    for j in F:
        if j == i:
            count += 1
    if max < count:

        max = count
    else:
        count = 0
        f = max
        max = 0
print(max if max > f else f)

Submission status: Runtime Error

Solution code:
s = input()
t = [0]*len(s)

for i in range(len(s)):
    if s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T':
        t[i] = 1

ans = []
tmp = 0
for j in t:
    if j == 1:
        tmp += 1
    else:
       ans.append(tmp)
       tmp = 0
print(max(ans))

Submission status: Runtime Error

Solution code:
def actual(s):
    sub_string_list = []

    N = len(s)
    for i in range(N):
        for j in range(N - 1):
            sub_string_list.append(s[i:j])

    set_ACGT = {'A', 'C', 'G', 'T'}
    length_list = []

    for sub_string in sub_string_list:
        if set(sub_string).issubset(set_ACGT):
            length_list.append(len(sub_string))

    return max(length_list)

s = input()
print(actual(s))

Submission status: Runtime Error

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

for i in reversed(range(0,n)):
  for j in range(0,n-i+1):
    s = S[j:j+i].strip("A").strip("C").strip("G").strip("T")
    if s == "":
      break

print(i)

Submission status: Runtime Error

Solution code:
string = input()

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

count = 0
lengths = []
for s in string:
    if s in char:
        count += 1
    else:
        lengths.append(count)
        count = 0
else:
    print(max(lengths))

Submission status: Runtime Error

Solution code:
S=str(input())
lst=['A','C','G','T']
ans=0

for i in range(len(S)):
    cnt=0
    if S[i] in lst:
        cnt+=1
        if i==len(S)-1:
            ans = max(ans,cnt)
            break
        while S[i+1] in lst:
            cnt+=1
            i+=1
            if i+1==len(S)-1:
                break
    ans=max(ans,cnt)

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
import sys
 
def main():
    S = input()
    l = len(S)
    
    cnt_l = []
    
    for i in range(l):
        cnt = 0
        for j in range(l-i):
            if str(S[i+j]) in ['A', 'C', 'G', 'T']:
                cnt += 1
            else:
                cnt_l.append(cnt)
 
    out = max(cnt_l)
 
    print(out)
main()

Submission status: Runtime Error

Solution code:
import sys
 
def main():
    S = input()
    l = len(S)
    
    cnt_l = []
    
    for i in range(l):
        cnt = 0
        for j in range(l-i):
            if str(S[i+j]) in ['A', 'C', 'G', 'T']:
                cnt += 1
            else:
                cnt_l.append(cnt)
 
    m = max(cnt_l)
 
    print(out)
main()

Submission status: Runtime Error

Solution code:
import sys

def main():
    S = input()
    l = len(S)
    
    cnt_l = []
    
    for i in range(l):
        cnt = 0
        for j in range(l-i):
            if str(S[i+j]) in ['A', 'C', 'G', 'T']:
                cnt += 1
            else:
                cnt_l.append(cnt)

    m = max(cnt_l)
    if m==0:
        out = 0
    else:
        m_index = cnt_l.index(m)
        m_l = m + m_index
        out = S[m_index:m_l]

    print(out)
main()

Submission status: Runtime Error

Solution code:
import sys

def main():
    S = input()
    l = len(S)
    
    cnt_l = []
    
    for i in range(l):
        cnt = 0
        for j in range(l-i):
            if str(S[i+j]) in ['A', 'C', 'G', 'T']:
                cnt += 1
            else:
                cnt_l.append(cnt)

    m = max(cnt_l)
    m_index = cnt_l.index(m)
    m_l = m + m_index
    out = S[m_index:m_l]

    print(out)
main()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

count = 0
clist = []
n = (len(l))
for i in range(n):
    if l[i] in 'ACGT':
        count += 1
    else:
        clist.append(count)
        count = 0
        
print(max(clist))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s = list(input())
t = [0] * len(s)
count = 0
ans = []
for i in range(len(s)):
    if s[i] == 'A' or s[i] =='C' or s[i] =='G' or s[i] =='T':
        t[i] = 1
        count += 1
    else:
        ans.append(count)
        count = 0
print(max(ans))

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10000000)
import numpy as np
from heapq import heapify, heappop, heappush
import copy
from math import gcd, ceil
from collections import deque
# queueとして使う場合 push, popleftを使う
from bisect import bisect_left, bisect_right
# bisect_left: 配列の順序関係が崩れない条件で挿入することができる一番左の点
# bisect_right: 配列の順序関係が崩れない条件で挿入することができる一番右の点
# A = [1, 1, 1, 2, 2, 2, 4]
# print(bisect_left(A, 2))  # 3
# print(bisect_right(A, 2))  # 6
# print(bisect_left(A, 3))  # 6
# print(bisect_right(A, 3))  # 6


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



if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
n=int(input())
count=0
for i in range(1,n+1):
    if i%2==1:
        yakusuu=0
        for j in range(1,int((i**0.5)//1)+1):
            if i%j==0:
                if j**2==i:
                    yakusuu+=1
                else:
                    yakusuu+=2
        if yakusuu==8:
            count+=1
print(count)

Submission status: Runtime Error

Solution code:
n = len(S)
ans_list = []
for i in range(n):
    for j in range(i + 1, n):
        T = S[i: j + 1]
        U = T.replace("A","").replace("C","").replace("G","").replace("T","")
        if U == "":
            ans_list.append(len(T))
print(max(ans_list))

Submission status: Runtime Error

Solution code:
# 初期入力
import sys
input = sys.stdin.readline
S =input().strip()

#ACGTが連続しているか判定
count =0
count_list=[]
for i in S:
    if i in "ACGT":
        count +=1
    else:
        count_list.append(count)
        count =0
print(max(count_list))

Submission status: Runtime Error

Solution code:
L = ['A','C','G','T']
S = list(input()) 
S = ['1' if ((i in L) == True) else '0' for i in S]
S = ''.join(S_list)
S = S.split('0')
S = [len(i) for i in S]
print(max(S))

Submission status: Runtime Error

Solution code:
S = return sys.stdin.readline().rstrip()
ans,temp = 0,0
for x in S:
    if x in 'ACGT':
        temp += 1
        ans = max(ans,temp)
    else:
        temp = 0
print(ans)

Submission status: Runtime Error

Solution code:
s = list(input())
count = []
x = ["A","T","G","C"]
c = 0
for i in range(len(s)):
    if (s[i] in x) == True:
        c += 1
    else:
        count.append(c)
        c = 0

print(max(count))

Submission status: Runtime Error

Solution code:
import  re

ss = input()
ps = r"A|C|G|T"

seq = []
counter = 0
for s in ss:
    if re.match(ps, s):
        counter += 1
        seq.append(counter)
    else:
        counter = 0
    
print(max(seq))

Submission status: Runtime Error

Solution code:
ss = input()
ps = "ACGT"

seq = []
counter = 0
for s in ss:
    if s in ps:
        counter += 1
        seq.append(counter)
    else:
        counter = 0
    
print(max(seq))

Submission status: Runtime Error

Solution code:
s = input()
n = len(s)
l = list("ACGT")
A = 0
for i in range(n):
  for j in range(i+1,n+1):
    x = s[i,j]
    if all(k in l for k in x):
      A = max(A,len(x))
print(A)

Submission status: Runtime Error

Solution code:
cnt = []
tmp = 0

b = str(input())
for i in range(0,len(b)):
  if b[i]=="A" or b[i]=="C" or b[i]=="G" or b[i]=="T":
    tmp=tmp+1
  else:
    cnt.append(tmp)
    tmp=0
print(max(cnt))

Submission status: Runtime Error

Solution code:
import re
s=input()
count=0
result=re.search(r'[ACGT]+',s)
i=result.group()
for _ in i:
    count+=1
print(count)

Submission status: Runtime Error

Solution code:
s=input()+"O"
tmp=""
ans=[]
for i in s:
  if i in ["A","T","G","C"]:
    tmp=tmp+i
  else:
    ans.append(tmp)
    tmp=""
res=0
for i in ans:
  if len(i)>len(res):
    res=len(i)
print(res)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S = input()
count = 0

for i in range(S):
  if i == "A" or i == "C" or i == "G" or i == "T":
    count += 1
print("%d"%(count))

Submission status: Runtime Error

Solution code:
S=list(input())
line=[]
A=["A","C","G","T"]
num_list=[]
flag=False
for s in S:
    if s in A:
        line.append(s)
        flag=True
    elif flag:
        num_list.append(len(line))
        line=[]
        flag=False
print(max(num_list))

Submission status: Runtime Error

Solution code:
S = input()
N = len(S)
l = []
for i in range(N):
  for j in range(i,N):
    s = S[i:j+1]
    if s.strip("A C G T") == "":
      l.append(s)

m = sorted(l, key=len)
print(len(m[-1]))

Submission status: Runtime Error

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

for a in s:
  if a == "A" or a == "T" or a == "C" or a == "G":
    ans += 1
  else:
    lis.append(ans)
    ans = 0

print(max(lis))

Submission status: Runtime Error

Solution code:
s =input()
ans = re.finditer(r'(A|T|G|C)+',s)
max=0
for a in ans:
    temp=len(a.group())
    if temp>=max:
        max=temp
print(max)

Submission status: Runtime Error

Solution code:
s=input()
clist=['A','C','G','T']
count=0
a=[]
for i in s:
  if i in clist:
    count+=1
  else:
    a.append(count)
    count=0

print(max(a))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S = list(input())
A = []
j = 0
ans = 0
while j < len(S):
  i = S[j]
  if i == "A" or i == "C" or i == "G" or i == "T":
    ans += 1
    j += 1
  else:
    A.append(ans)
    ans = 0
    j += 1
print(max(A))

Submission status: Runtime Error

Solution code:
S= str(input())
#N,K = map(int,input().split())
#N = int(input())
#V = list(map(int,input().split()))
C=[]
c=0
for i in range(len(S)):
    if S[i]=='A' or S[i]=='T' or S[i]=='C' or S[i]=='G':
        c+=1
    else:
        C.append(c)
        c=0

print(max(C))

Submission status: Runtime Error

Solution code:
S = list(input())
A = []

i = 0

for _ in S:
  if _=='A' or _=='G' or _=='C' or _=='T':
    i += 1
    
  else:
    A.append(i)
    i = 0
    
print(max(A))

Submission status: Runtime Error

Solution code:
s = input()

ans=0
counter = 0
for c in s:
  if c=='A' or c=='C' or c=='G' or c=-'T':
    counter+=1
  else:
    ans = max(ans,counter)
    counter==0
print(ans)

Submission status: Runtime Error

Solution code:
S = input()
s = {"A", "T", "C", "G"}
low = []
for i in range(len(S)):
    if S[i] in s:
        low.append(i)
high = []
for i in reversed(range(len(S))):
    if S[i] in s:
        high.append(i)

ans = []
for i in low:
    for j in high:
        if (set(S[i:j+1]) - s) == set():
            ans.append(len(S[i:j+1]))

print(max(ans))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s=list(input())
t=[]
for i in range(len(s)):
    if s[i]!="A" and s[i]!="C" and s[i]!="G"and s[i]!="T":
        t.append(i)
t=[-1]+t
u=[]
for i in range(len(t)-1):
    u.append(t[i+1]-t[i])
print(max(u)-1)

Submission status: Runtime Error

Solution code:
S = list(input())

c = 0
ans = 0

for i in S:
    if i=='A' or i=='C' or i=='G' or i=='T':
        c += 1
        if ans < c:
        ans = c
    else:
        c = 0

print(ans)

Submission status: Runtime Error

Solution code:
S = input()

res = []
tmp = []
for s in S:
    if s == 'A' or s == 'C' or s == 'G' or s == 'T':
        tmp.append(s)
    else:
        res.append(len(tmp))
        tmp = []

print(max(res))

Submission status: Runtime Error

Solution code:
S = input()

res = []
tmp = ['']
for s in S:
    if s == 'A' or s == 'C' or s == 'G' or s == 'T':
        tmp.append(s)
    else:
        res.append(len(tmp))
        tmp = ['']

print(max(res))

Submission status: Runtime Error

Solution code:
S = input()
T = "ACGT"
ans = 0
for s in S:
    if s in T:
        cnt += 1
    else:
        if cnt > ans:
            ans = cnt
        cnt = 0
print(ans)

Submission status: Runtime Error

Solution code:
S=input()
sum,ans=0,[]

for s in S:
  if s in "ACGT":
    sum += 1
  else:
    ans.append(sum)
    sum = 0
print(max(max(ans),sum))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
ACGT = ["A", "C" ,"G", "T"]
s = input()
ans = 0, temp = 0
for i in s:
  ok = False
  for j in ACGT:
    if i == j:
      ok = True
      temp += 1
  if ok == False:
    ans = max(ans, temp)
    temp = 0
ans = max(ans, temp)
print(ans)

Submission status: Runtime Error

Solution code:
s = input()

l = [0]*len(s)
for i in range(len(s)):
    if s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or  s[i] == 'T':
        l[i]=1
        
a = []
ans=0
for k in l:
    if k==1:
        ans += k
    else:
        a.append(ans)
        ans=0
        
print(max(a))