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: Accepted

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

Submission status: Accepted

Solution code:
s=input()

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

print(ans)

Submission status: Accepted

Solution code:
S = input()

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

c = 0
mx = 0
for si in s:
    if si in ("A", "C", "G", "T"):
        c += 1
        if c > mx:
            mx = c
    else:
        c = 0

print(mx)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    s = input()
    w = "ATCG"

    def f(ss):
        c = 0
        for i in range(len(ss)):
            if ss[i] not in w:
                return c
            c += 1
        return c

    res = 0
    for i in range(len(s)):
        res = max(res, f(s[i:]))
    print(res)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s=list(input())
for i in range(len(s)):
    w=s[i]
    if w!="A" and w!="T" and w!="G" and w!="C":
        s[i]=" "
l="".join(s).split()
p=0
for i in l:
    if len(i) > p:
        p=len(i)
print(p)

Submission status: Accepted

Solution code:
S = input()

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

print( length )

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()
 
s = {'A','T','G','C'}
 
ans = 0
for i,q in enumerate(S):
    cur  =0
    ind = i
    while ind < len(S) and S[ind] in s:
        cur += 1
        ind += 1
    ans = max(ans, cur)
print(ans)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
import re
S = input()
S = re.split(r'[^ACGT]', S)
maxlen = max(len(s) for s in S)
print(maxlen)

Submission status: Accepted

Solution code:
s=list(input())
ATGC=['A','G','T','C']
counter=0
max_count=0

for i in s:
    if i in ATGC:
        counter+=1
    else:
        max_count=max(counter,max_count)
        counter=0
max_count=max(counter,max_count)
print(max_count)

Submission status: Accepted

Solution code:
s = input()
n = len(s)
ans = 0
def check(s):
    for i in s:
        if i not in 'AGCT':
            return False
    return True

for i in range(n):
    for j in range(i+1,n+1):
        p = s[i:j]
        if check(p):
            ans = max(ans, j-i)
print(ans)

Submission status: Accepted

Solution code:
# coding:utf-8

import sys
# from collections import Counter, defaultdict

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


def main():
    s = SI()

    res = 0
    for l in range(len(s)):
        for r in range(l, len(s)):
            t = s[l:r + 1]
            if all([1 if c in 'ACGT' else 0 for c in t]):
                res = max(res, len(t))

    return res


print(main())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
S=input()

L=len(S)
ANS=0
SET={"A","C","G","T"}
for i in range(L):
    for j in range(i,L+1):
        X=S[i:j]

        for x in X:
            if x in SET:
                continue
            else:
                break

        else:
            ANS=max(ANS,len(X))

print(ANS)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()

def main():
    S = SI()
    ans = 0
    tmp = 0
    for s in S:
        if s in 'ACGT':
            tmp += 1
        else:
            ans = max(ans, tmp)
            tmp = 0
    ans = max(ans, tmp)

    return ans

print(main())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
word = input()
ans = 0

for i in range(len(word)):
  tmp = 0
  for j in range(len(word)-i):
    if word[j+i]=="A" or word[j+i]=="T" or word[j+i]=="C" or word[j+i]=="G":
      tmp += 1
    else: break
  if tmp>ans: ans = tmp

print(ans)

Submission status: Accepted

Solution code:
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = s_inpl()   |	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = inpl()	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]

import math
import numpy as np
import copy
from collections import defaultdict, Counter
from itertools import product
from bisect import bisect_left, bisect_right

def s_inpl(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))

S = input()

ans = 0
tmp = 0
for si in S:
    if si == "A" or si == "T" or si == "C" or si == "G":
        tmp += 1
    else:
        if tmp > ans:
            ans = tmp

        tmp = 0
    if tmp > ans:
        ans = tmp

print(ans)

Submission status: Accepted

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

s = input()

cur = 0
max = 0

for index,item in enumerate(s):
    if item == "A" or item == "T" or item == "G" or item == "C":
        cur += 1
        if cur >= max:
            max = cur
    else:
        cur = 0

print(max)

Submission status: Accepted

Solution code:
S = input()

count = 0
max_count = 0
for s in S:
    if s == "A" or s == "T" or s == "G" or s == "C":
        count += 1
    else:
        count = 0
    if max_count <= count:
        max_count = count

print(max_count)

Submission status: Accepted

Solution code:
s = str(input())
L = list("ACGT")
ans = 0
check = 0
for i in range(len(s)):
  if s[i] in L:
    check +=1
  else:
    ans = max(ans, check)
    check = 0
ans = max(ans, check)
print(ans)

Submission status: Accepted

Solution code:
S = input()

count = 0
num = 0
acgt = "ACGT"
for s in S:
  if s in acgt:
    num += 1
  else:
    num = 0
    
  if num > count:
    count = num
    
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())

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

ans = 0
li = []
flag = 0
for i in range(len(S)):
    if S[i] in a:
        ans += 1
    else:
        li.append(ans)
        ans = 0
li.append(ans)

print(max(li))

Submission status: Accepted

Solution code:
def int_raw():
    return int(raw_input())

def ss_raw():
    return raw_input().split()

def ints_raw():
    return map(int,ss_raw())

INF = 1<<29

def make1d_arr(n,val=INF):
    return [val for i in xrange(n)]

def make2d_arr(w,h,val =INF):
    return [[val for i in xrange(w)]for i in xrange(h)]

table = {"A":"T", "C":"G", "G":"C", "T":"A" }
S = raw_input()

ans = 0
for i in xrange(len(S)):
    for j in xrange(i,len(S)):
        if S[j] in table:
            ans = max(ans,j-i+1)
        else:
            break
print ans

Submission status: Accepted

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

Submission status: Accepted

Solution code:

def main():
    atgc = ["A", "T", "G", "C"]
    s=input()
    #=[int(i) for i in input().split()]
    cnt = 0
    ans = 0
    for i in range(len(s)):
        if s[i] in atgc:
            cnt += 1
        else:
            cnt = 0
        ans = max(ans, cnt)
    print(ans)

main()

Submission status: Accepted

Solution code:
import sys
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()

s = input()
ans1 = 0
ans = 0
for a in s:
    if a == "A":
        # print("T")
        ans+=1
    elif a == "T":
        # print("A")
        ans += 1

    elif a == "C":
        ans += 1
    elif a == "G":
        ans+=1
    else:
        ans = 0
    if ans > ans1:
        ans1 = ans
print(ans1)

Submission status: Accepted

Solution code:
S = input()

t = ["A", "T", "C", "G"]
ans = 0
now = ""
for s in S:
    if s in t:
        now += s
    else:
        now = ""
    ans = max(ans, len(now))
print(ans)

Submission status: Accepted

Solution code:
n = list(input())

co = 0
su = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
max_len = 0
current_len = 0
for c in S:
    if c=='A' or c=='C' or c=='G' or c=='T':
        current_len += 1
    else:
        if current_len > max_len:
            max_len = current_len
        current_len = 0
if current_len > max_len:
    max_len = current_len
print(max_len)

Submission status: Accepted

Solution code:

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

Submission status: Accepted

Solution code:
from math import *





s=input()

c=0

for i in range(len(s)):
	for j in range(i,len(s)):
		d=s[i:j+1]
		if(len(d)==(d.count('A')+d.count('C')+d.count('G')+d.count('T'))):
			c=max(c,len(d))
print(c)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
n = len(s)
cnt = 0
ans = 0
for i in range(n):
  if s[i] in "ATCG":
    cnt += 1
  else:
    if cnt > ans:
      ans = cnt
    cnt = 0
print(max(cnt,ans))

Submission status: Accepted

Solution code:
import atexit
import io
import sys

buff = io.BytesIO()
sys.stdout = buff


@atexit.register
def write():
    sys.__stdout__.write(buff.getvalue())

s = raw_input()
n = len(s)
ans = 0
l = ['A', 'C', 'T', 'G']
for i in xrange(n):
	for j in xrange(i,n):
		valid = 1
		for k in xrange(i,j+1):
			if s[k] not in l:
				valid = 0
				break
		if valid:
			ans = max(ans, j-i+1)	
print ans

Submission status: Accepted

Solution code:
s = input()
#a = [int(i) for i in input().split()]
#s = [[int(j) for j in input().split()] for i in range(N)]
tar=['A','C','G','T']
fs = [c in tar for c in s]
res = 0
cnt=0
for f in fs:
    if f:
        cnt+=1
        res=max(res,cnt)
    else:
        cnt=0
print(res)

Submission status: Accepted

Solution code:
s = input()

maxlen = 0

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

for i in range(len(s)):
  l = 0
  for j in range(i,len(s)):
    if s[j] in dna:
      l+=1
    else:
      break
  maxlen = max(maxlen,l)
print(maxlen)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def li(): return list(input().rstrip())
# template


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

print(maxs)

Submission status: Accepted

Solution code:
S = input()

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

print(max(ma,ans))

Submission status: Accepted

Solution code:
# N,M = map(int, input().split())
S = input()
N = len(S)

ans = 0
for i in range(N):
    if not S[i] in "ATCG":
        continue
    tmp = 0
    j = i
    while S[j] in "ATCG":
        j += 1
        tmp += 1
        if j >= N:
            break
    ans = max(ans, tmp)

print(ans)

Submission status: Accepted

Solution code:
a = input()
ans = 0
tmp = 0
for i in a:
  if i == "A" or i == "C" or i == "G" or i == "T":
    tmp += 1
  else:
    if ans < tmp:
      ans = tmp
      tmp = 0
if ans < tmp:
  ans = tmp
print(ans)

Submission status: Accepted

Solution code:
s = input()

ans = 0
temp = 0

for c in s:
    if c == "A" or c == "C" or c == "G" or c == "T":
        temp += 1
    else:
        if ans < temp:
            ans = temp
            temp = 0

if ans < temp:
    ans = temp

print(ans)

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
def solve(S):
    ans = 0
    tans = 0
    for s in S:
        if s in "ACGT":
            tans += 1
            ans = max(ans, tans)
        else:
            tans = 0
    return ans

if __name__ == "__main__":
    S = input()
    print(solve(S))

Submission status: Accepted

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

count = 0
max_count = 0
for i in s:
    if i in acgt:
        count += 1
    else:
        count = 0
    if max_count < count:
        max_count = count
print(max_count)

Submission status: Accepted

Solution code:

atgc=set(["A","T","G","C"])

S=input()
count=0
max_count=0
for i in range(len(S)):
    if S[i] in atgc:
        count+=1
    else:
        count=0
    max_count=max(count,max_count)

print(max_count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=str(input())
n=len(s)
ans=0
i=0
while(i<n):
	if(s[i] in 'ACGT'):
		count=0
		while(i<n and s[i] in 'ACGT'):
			i+=1
			count+=1
		ans=max(ans,count)
	else:
		i+=1
print(ans)

Submission status: Accepted

Solution code:
S = input()

start = -1
answer = 0

for i, s in enumerate(S):
  if s in ['A','T','G','C']:
    answer = max(answer, i-start)
  else:
    start=i
print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for s in S:
    if s in 'ACGT':
        count += 1
    else:
        ans.append(count)
        count = 0
ans.append(count)
print(max(ans))

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc122/tasks/abc122_b

import itertools
import collections
import bisect

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()
cnt = ans = 0
for c in S:
    if c in "ATCG":
        cnt += 1
    else:
        ans = max(cnt, ans)
        cnt = 0
ans = max(cnt, ans)
print(ans)

Submission status: Accepted

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

num = max(num, tmp)
print(num)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections as c
ip = lambda : map(int, input().split())

#################
S = input()
r = 0
tmp = 0
for i in S:
    if i in ['A','G','C','T']:
        tmp += 1
        r = max(r,tmp)
    else:
        tmp = 0

print(r)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
res = 0
for i in range(len(s)):
    for j in range(i + 1, len(s) + 1):
        t = s[i:j]
        c = 0
        for sss in 'ATGC':
            c += t.count(sss)
        if c == len(t):
            res = max(res, c)
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque, defaultdict as ddic
from itertools import combinations, permutations, product
from heapq import heappush, heappop, heapify
import sys
stdout = sys.stdout
rr = lambda: input().strip()
rri = lambda: int(rr())
rrm = lambda: list(map(int, rr().split()))

from itertools import groupby
def solve(S):
    def f(c):
        return c in 'ACGT'
    ans = 0
    for k, grp in groupby(S, f):
        w = len(list(grp))
        if k:
            ans = max(ans, w)
    return ans

T = 1 #rri()
for tc in range(1, T+1):
    S = rr()
    ans = solve(S)
    print(ans)
    #print("Case #{}: {}".format(tc, ans))

Submission status: Accepted

Solution code:
S = input()

len = 0
ans = 0
for ch in S:
    if ch in 'ACGT':
        len += 1
        ans = max(ans, len)
    else:
        len = 0
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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
    else:
        length.append(tmp)
        tmp=0
print(max(length))

Submission status: Runtime Error

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


result.sort()
print(result[-1])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

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

print(max(l))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s =  list(input())
combo = False
cnt = 0
ans = [] 
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: Runtime Error

Solution code:
s = input()
ans = ''
lst = []
for ss in s:
    if ss in ['A', 'C', 'G', 'T']:
        ans += ss
    else:
        lst.append(len(ans))
        ans = ''
print(max(lst))

Submission status: Runtime Error

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

Submission status: Runtime Error

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
print(max(ans))

Submission status: Runtime Error

Solution code:
import re
S = input()
string = re.findall(r'([ACGT]+)', S)

lenst = [len(x) for x in string]
print(max(lenst))

Submission status: Runtime Error

Solution code:
s = input()
count = 0
lens = []

for i, _ in enumerate(s):
  for c in s[i:]:
    if c in ['A', 'G', 'C', 'T']:
      count += 1
  	else:
      break
  lens.append(count)
  count = 0
  
print(max(lens))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S = input()

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

count_list = []
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: Runtime Error

Solution code:
n = input()
count=0
m = 0
for i 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: Runtime Error

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

Submission status: Runtime Error

Solution code:
s = input()
x = list()
cnt = 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
    else:
        x.append(cnt)
        cnt = 0
print(max(x))

Submission status: Runtime Error

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

Submission status: Runtime Error

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):
            if S[i+j+1] in ACGT:
                cnt += 1
            else:
                ans[i] = cnt
                break

print(max(ans))

Submission status: Runtime Error

Solution code:
N =str(input())
str_list = list(N)
count = 0
count_n = 0
for i in range(h):
    kari = str_list[i]
    if(kari =="A" or kari =="C" or kari =="G" or kari =="T"):
        count += 1
    else:
        if(count > count_n):
            count_n = count
        count = 0
print(count_n)

Submission status: Runtime Error

Solution code:
N =str(input())
str_list = list(N)
count = 0
count_n = 0
for i in range(h):
    kari = str_list[i]
    if(kari =="A" or kari =="C" or kari =="G" or kari =="T"):
        count += 1
    else:
        if(count > count_n):
            count_n = count
        count = 0
print(count_n)

Submission status: Runtime Error

Solution code:
s = str(input())
w = ""
l = []
for i in s:
    if i=='A' or i=='C' or i=='G' or i=='T':
        w += i
    else:
        l.append(len(w))
        w = ""
print(max(l))

Submission status: Runtime Error

Solution code:
n = input()
l = []
v = []
for t in n:
  if t == 'A' or t == 'C' or t == 'G' or t == 'T':
    v.append(t)
  else:
    l.append(v)
    v = []
print(len(max(l)))

Submission status: Runtime Error

Solution code:
s = str(input())
mx = 0
for i in range(n):
    for j in range(i+1,n+1):
        cnt = j-i-1
        p = 0
        for k in list(s[i:j]):
            if k in ["A","C","G","T"]:
                p += 1
        if p == cnt:
            if p > mx:
                mx = p
print(mx)

Submission status: Runtime Error

Solution code:
S = input()

# ACGT 

num = 0
result = []

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

Submission status: Runtime Error

Solution code:
import sys
lines = [s.rstrip("\n") for s in sys.stdin.readlines()]
input = lines.pop(0)
acgt = tuple("ACGT")
max_num_list = []
max_num = 0
for c in input:
    if c in acgt:
        max_num += 1
    else:
        max_num_list.append(max_num)
        max_num = 0
print(max(max_num_list))

Submission status: Runtime Error

Solution code:
s=input()
temp=0
ans=0
tar="ACGT"
for ch in s:
  if ch in tar:
    temp+=1
  else:
    if ans=<temp:
      ans=temp
    temp=0

print(ans)

Submission status: Runtime Error

Solution code:
S=input()
 
acgt_list=[]
for i in range(len(S)):
  for j in range(i+1,len(S)+1):
    slen=len(S[i:j])
    temp=0
    for s in S[i:j] :
      if s=='A' or s=='C' or s=='G' or s== 'T':
        temp+=1      
    if temp==slen:
      acgt_list.append(slen)
      
print(max(acgt_list))

Submission status: Runtime Error

Solution code:
S=input()

actg_list=[]
for i in range(len(S)):
  for j in range(i+1,len(S)+1):
    slen=len(S[i:j])
    temp=0
    for s in S[i:j] :
      if s=='A' or s=='C' or s=='G' or s== 'T':
        temp+=1      
    if temp==slen:
      atcg_list.append(slen)
      
print(max(atcg_list))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S = list(input())

ans = []
ans_ = 0
for s in S:
    if s=="A" or s=="C" or s=="G" or s=="T":
        ans_ += 1
    else:
        ans.append(ans_)
        ans_ = 0
print(max(ans))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# ABC122 B - ATCoder

S=str(input())
AC = 'ATGC'
N = []
count=0
for i in range(len(S)):
    if S[i] not in AC:
        N.append(i)
    else:
        count+=1
if count == lens(S):
    print(count)
    exit()

M = N[0]
for j in range(len(N)-1):
    M = max( N[j+1] - N[j],M)
print(M)

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]
for j in range(len(N)-1):
    M = max( N[j+1] - N[j],M)
print(M)