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()
count = 0
for i in range(len(S)):
    if S[i] in 'ACGT':
        count += 1
print(count)

Submission status: Wrong Answer

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

Submission status: Time Limit Exceeded

Solution code:
S=input()
ACGT=['A','C','G','T']
ans=[]
k=0
while k<len(S):
    num=0
    if S[k] in ACGT:
        num=1
        for i in range(1,len(S)-k):
            if S[k+i] in ACGT:
                num+=1
            else:
                break
    ans.append(num)
    k=+num

print(max(ans))

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
S = input()
n = len(S)
l = np.zeros(n, dtype=int)
DNA = ['A', 'G', 'C', 'T']

i = 0
while(i < n):
  if(S[i] in DNA):
    if(i == n-1):
      l[i] = 1
      i+=1
    else:
      for j in range(i+1, n):
        if(S[j] not in DNA):
          l[i] = j-i
          i = j+1
          break;
  else:
    i += 1
print(max(l))

Submission status: Time Limit Exceeded

Solution code:
s = str(input())

result = [0]
i = 0
while i < len(s):
    counter = 0
    while i + counter < len(s):
        if s[i+counter] == 'A' or s[i+counter] == 'T' or s[i+counter] == 'G' or s[i+counter] == 'C':
            counter += 1
        else:
            result.append(counter)
            i += counter +1
print(max(result))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
s = input()

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

index = 0
count = 0
count_list = []

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

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

Submission status: Time Limit Exceeded

Solution code:
import re
if __name__ =="__main__":
    string = input()
    pattern=["A","G","C","T"]
    point = 0
    max_len = 0
    while(True):
        stack_max = 0
        if max_len>(len(string)-point):
            break
        for x in range(point,len(string)):
            if string[x] in pattern:
                stack_max += 1
            else:
                point = x+1
                max_len = max(max_len,stack_max)
                break
        if point == len(string):
            break
        
    print(max_len)

Submission status: Time Limit Exceeded

Solution code:
S=input()
ACGT=["A","C","G","T"]
m=0
for i in range(len(S)):
  n=0
  while S[i] in ACGT:
    n+=1
  m=max(m,n)
print(m)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
inp = input()
ACGT = ["", "A", "C", "G", "T"]
sentences = [i+j+k+l+m+n+o+p+q+r+s for i in ACGT for j in ACGT for k in ACGT for l in ACGT for m in ACGT for n in ACGT for o in ACGT for p in ACGT for q in ACGT for r in ACGT for s in ACGT]
length = [len(sent) for sent in sentences if sent in inp]
print(np.max(length))

Submission status: Time Limit Exceeded

Solution code:
from itertools import product

S = input()
T = set()
for i in range(len(S)):
  for j in range(len(S)):
    T.add(S[i:i+j+1])

check = []
for i in range(len(S)+1):
  for per in product(["A","C","G","T"], repeat = i):
    per = "".join(per)
    check.append(per)
check = list(set(check))

ans = 0
for t in T:
  tt = "".join(t)
  if(tt in check):
    ans = max(ans, len(tt))
print(ans)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    s = tuple(input())
    r = 0
    s_len = len(s)
    for i1 in range(s_len):
        for i2 in range(i1 + 1, s_len + 1):
            if all([c in ('A', 'T', 'C', 'G') for c in s[i1:i2]]):
                r = max(r, i2 - i1)
    print(r)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    s = tuple(input())
    r = 0
    s_len = len(s)
    for i1 in range(s_len):
        for i2 in range(1, s_len - i1 + 1):
            if all([c in ('A', 'T', 'C', 'G') for c in s[i1:i1+i2]]):
                r = max(r, i2)
    print(r)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
moji = str(input())
ans = 0
cans = 0
correct = ["A","C","G","T"]
for i in range(len(moji)):
    if moji[i] in correct:
        cans += 1
        if cans > ans:
            ans = cans
    else:
        if cans > ans:
            ans = cans
        cans = 0
print(ans)

Submission status: Accepted

Solution code:
s = input()
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: Accepted

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

Submission status: Accepted

Solution code:
S = input()
L = len(S)
ans = 0
for i in range(L):
    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: Accepted

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
    x = 0
if ans < x:
  ans = x
print (ans)

Submission status: Accepted

Solution code:
s = list(input())
cnt, new_cnt = 0, 0
for x in s:
    if x == "A" or x == "C" or x == "G" or x == "T":
        new_cnt += 1
        if cnt < new_cnt:
            cnt = new_cnt
    else:
        new_cnt = 0

print(cnt)

Submission status: Accepted

Solution code:
S = input()

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

print(ans)

Submission status: Accepted

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


def solve(S: str):
    ans = 0
    c = 0
    for i in S:
        if i in ["A", "C", "G", "T"]:
            c += 1
        else:
            c = 0
        if c > ans:
            ans = c
    print(ans)

    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()

mx = 0
cnt = 0

for (i, char) in enumerate(s):
    if char in "ACGT":
        cnt += 1
    else:
        mx = max(mx, cnt)
        cnt = 0

mx = max(cnt, mx)

print(mx)

Submission status: Accepted

Solution code:
s = input()

count = 0
ans = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re
S = input()
r = re.findall('[ACTG]+', S)
print(max([len(_) for _ in r], default=0))

Submission status: Accepted

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
if ans < temp:
  ans = temp
print(ans)

Submission status: Accepted

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
            maxi= max(count, maxi)
        else:
            count = 0

    print(maxi)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()
score=0
ans=[]
for i in s:
  if i in {"A", "T", "C", "G"}:
    score+=1
  else:
    score=0
  ans.append(score)
print(max(ans))

Submission status: Accepted

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

Submission status: Accepted

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

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

    ans = max(length, ans)

print(ans)

Submission status: Accepted

Solution code:
S = list(input())

count = 0
ans = 0
flg = False

for word in S:
    if word=="A" or word=="C" or word=="G" or word=="T":
        flg = True
    else:
        flg=False
        count = 0
    
    if flg:
        count += 1
    ans = max(ans,count)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
# 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
        if i == len(S)-1:
            ctM.append(ct)
    else:
        ctM.append(ct)
        ct = 0
print(max(ctM))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-
import re
S = input()
S_sp = re.split("[^ACGT]",S)
ans = 0
for moji in S_sp:
    if len(moji) > ans:
        ans = len(moji) 

print(ans)

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

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(max(length))

Submission status: Accepted

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

ans = 0
now = 0
for i in s:
    if i in l:
        now += 1
        if now > ans:
            ans = now
    else:
        now = 0

print(ans)

Submission status: Accepted

Solution code:
s = list(input())
n = len(s)
res = 0
for i in range(n):
    for j in range(i,n):
        temp = s[i:j+1]
        if all(i in 'ATGC' for i in temp):
            res = max(res,len(temp))
print(res)

Submission status: Accepted

Solution code:
S = input()
S += '*'
st = 'ACGT'
i, n = 0, len(S)
max_len = 0
while i < n:
    j = i
    size = 0
    while S[j] in st:
        size += 1
        j += 1
    i = j+1
    max_len = max(max_len, size)
print(max_len)

Submission status: Accepted

Solution code:
items = ['A', 'C', 'G', 'T']
 
def max(a, b):
    return a if a > b else b
x= 0
y = 0
for c in list(input()):
    if c in items:
 
        y += 1
        x = max(x, y)
    else:
        y = 0
print(x)

Submission status: Accepted

Solution code:
s = input()
S = ""
for i in s:
    if i in "ACGT":S+="1"
    else:S+="0"
print(max(list(map(len,S.split("0")))))

Submission status: Accepted

Solution code:
s = input()
S = ""
for i in s:
    if i in "ACGT":
        S+="1"
    else:
        S+="0"
        
ans = max(list(map(len,S.split("0"))))
print(ans)

Submission status: Accepted

Solution code:
import re
print(max([0]+[len(r) for r in re.findall("[ACGT]+",input())]))

Submission status: Accepted

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

Submission status: Accepted

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

for i in s:
    if a.count(i):
        cnt += 1
        if ans < cnt:
            ans = cnt
    else:
        cnt = 0

print(ans)

Submission status: Accepted

Solution code:
s = input()
ans = 0
for i in range(len(s)):
  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: Accepted

Solution code:
#!/usr/bin/python3
#coding: utf-8

S = input()

N = len(S)

ret = 0
for i in range(N):
    for j in range(i, N):
        sub = S[i:j+1]
        if all(c in ('A', 'C', 'G', 'T') for c in sub):
            ret = max(ret, len(sub))

print(ret)

Submission status: Accepted

Solution code:
s = list(input())

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

s = ''.join(s)
n = s.count('A')

for i in range(n+1)[::-1]:
    if 'A' * i in s:
        print(i)
        break
else:
    print(0)

Submission status: Accepted

Solution code:
S=input()
N=len(S)
ans=0
for l in range(N):
    for r in range(l+1,N+1):
        for c in S[l:r]:
            if c not in "ACGT":
                break
        else:
            ans=max(ans,r-l)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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
if max < count:
    max = count
print(max)

Submission status: Accepted

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.append(i)
result.sort()
print(result[-1])

Submission status: Accepted

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()
    S += "$"

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

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

print(ans)

Submission status: Accepted

Solution code:
s=input()
l = [0]
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: Accepted

Solution code:
s = input()
l = len(s)
ans = 0
for i in range(l):
    for j in range(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: Accepted

Solution code:
S=input()
S+='S'
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: Accepted

Solution code:
S = input()

ans = 0
l = 0

for c in S:
    l += 1
    if not c in ('A', 'C', 'G', 'T'):
        l = 0
    ans = max(ans, l)

print(ans)

Submission status: Accepted

Solution code:
S = input()
ans_list = []
count = 0
for s in S:
    if s == 'A':
        count += 1
    elif s == 'T':
        count += 1
    elif s == 'G':
        count += 1
    elif s == 'C':
        count += 1
    else:
        count = 0
    ans_list.append(count)
print(max(ans_list))

Submission status: Accepted

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

Submission status: Accepted

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
    else:
        cnt = 0

print(cntmax)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()

count=0
a_list=[]
b_list=["A", "C", "G", "T"]
num=len(s)

for i in range(num):
    if s[i] in b_list:
        count+=1
    else:
        a_list.append(count)
        count=0
a_list.append(count)

print(max(a_list))

Submission status: Accepted

Solution code:
items = ['A', 'C', 'G', 'T']

s = input()
n = len(s)
t = [0] * (n+1)

for i in range(n):
    if s[i] in items:
        t[i + 1] += t[i] + 1
    else:
        t[i + 1] += 0
print(max(t))

Submission status: Accepted

Solution code:
items = ['A', 'C', 'G', 'T']

def chkmax(a, b):
    return a if a > b else b

res = 0
cnt = 0
for c in list(input()):
    if c in items:
        cnt += 1
        res = chkmax(res, cnt)
    else:
        cnt = 0
print(res)

Submission status: Accepted

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

l.append(cnt)
print(max(l))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import re
print(max(len(i) for i in re.sub(r'[^ACGT]', '_', input()).split('_')))

Submission status: Accepted

Solution code:
# author:  Taichicchi
# created: 09.09.2020 23:22:31

import sys

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

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)



'''
ans = 0
memo = 0

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


print(ans)

Submission status: Accepted

Solution code:
S = input()
T = S.replace('A','1').replace('C','1').replace('G','1').replace('T','1')
a = 0
for s in range(10):
  if '1'*(10-s) in T:
    a=1
    print(10-s)
    break
if a == 0:
  print('0')

Submission status: Accepted

Solution code:
S = str(input())
M = []
con = 0
for j in S:
  if j == 'A' or j == 'C' or j == 'G' or j == 'T':
    con += 1
  else:
    if con != 0:
      M.append(con)
    con = 0
M.append(con)
print(max(M))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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,len(s[i:j+1]))
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
l = len(s)
ans = 0
for i in range(l):
    loc = 0
    idx = i 
    while s[idx] in ["A","C","G","T"] and idx<l:
        loc += 1
        idx += 1
        if idx>=l:
            break
    ans = max(ans,loc)
print(ans)

Submission status: Accepted

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 c<b:
      c=b
  if a[i]!="A" and a[i]!="C" and a[i]!="G" and a[i]!="T":
    b=0
print(c)

Submission status: Accepted

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
    else:
        if combo:
            ans.append(cnt)
            cnt = 0
            combo = False
ans.append(cnt)
print(max(ans))

Submission status: Accepted

Solution code:
argStr = input()
ret=0
tmp=0
flag = False
for s in argStr:
    
    if (s=='A') | (s == 'C') | (s=='G') | (s=='T'):
        flag = True
        tmp+=1
    else:
        if flag :
            if( ret < tmp):
                ret = tmp
                tmp = 0
            flag = False
if( ret < tmp):
    ret = tmp
print(ret)

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(N):
    cnt=0
    for j in range(0,N-i):
        if S[i+j] in A:
            cnt+=1
        else:
            break
    ans=max(ans,cnt)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())

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

print(max(ans))

Submission status: Accepted

Solution code:
S = list(input())

ans_s = ''
for i in range(len(S)):
    for k in range(len(S[i:])):
        cnt = 0
        for s in S[i:i+k+1]:
            if s in ['A', 'C', 'G', 'T']:
                cnt += 1
        if cnt == len(S[i:i+k+1]) and cnt >= len(ans_s):
            ans_s = S[i:i+k+1]

print(len(ans_s))

Submission status: Accepted

Solution code:
s = input()
s += 'q'
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: Accepted

Solution code:
# B - ATCoder
S = 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: Accepted

Solution code:
s = input()
sn = len(s)

tmp = 0
for i in range(sn):
    for j in range(i + 1, sn + 1):
        t = s[i : j]
        tn = len(t)
        #print(t)
        cnt_t = 0
        for k in range(tn):
            if t[k] == "A" or t[k] == "G" or t[k] == "C" or t[k] == "T":
                cnt_t += 1
                #print(cnt_t)
                if cnt_t == tn and tmp < j - i:
                    tmp = j - i

print(tmp)

Submission status: Accepted

Solution code:
S = input()

ans = 0
for i in range(len(S)):
    for j in range(i+1, len(S)+1):
        for s in S[i:j]:
            if s != "A" and s != "C" and s != "G" and s != "T":
                break
        else:
            ans = max(ans, len(S[i:j]))
print(ans)

Submission status: Accepted

Solution code:
# 各桁の数値の総和を計算する.
def calc_digit_sum(num):
    sums = 0
    while num > 0:
        sums += num % 10
        num //= 10
    return sums


s = input()
contains = set(["A", "C", "G", "T"])

answer = cnt = 0
for ch in s:
    if ch not in contains:
        cnt = 0
    else:
        cnt += 1
    answer = max(answer, cnt)

print(answer)

Submission status: Accepted

Solution code:
S = input()
check = set("AGCT")

max_cnt = 0
for i in range(len(S)):
  cnt = 0
  for j in range(0,len(S)-i):
    #print(S[i+j],end="")
    if S[i+j] in check:
      cnt += 1
      max_cnt = max(max_cnt,cnt)
    else:
      break
      
print(max_cnt)

Submission status: Accepted

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

Submission status: Accepted

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
ans += [c]
if ans == []:
    print(len(s))
else:
    print(max(ans))

Submission status: Accepted

Solution code:
import sys
import math
import numpy as np
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":
    def f(s):
        if s == "":return 0
        t = s.replace("A","").replace("T","").replace("G","").replace("C","")
        if t == "":return len(s)
        else:return 0
    s = S()
    n = len(s)
    ans = 0
    cnt = 0
    for i in range(n):
        for j in range(i,n):
            t = s[i:j+1]
            ans = max(f(t),ans)
    print(ans)

Submission status: Accepted

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
			if i == len(s)-1:
				ans = max(ans, cnt)
	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: Accepted

Solution code:
S=str(input())
S=list(map(str,S))
count=0
real_count=0
for i in range(len(S)):
  if S[i]=='A' or S[i]=='C' or S[i]=='G' or S[i]=='T':
    for j in range(i,len(S)):
      if S[j]=='A' or S[j]=='C' or S[j]=='G' or S[j]=='T':
        count+=1
      else:
        break
    if count>real_count:
      real_count=count
    count=0
print(real_count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
a, l = 0, 0
for i in s:
  if i in "ATGC":
    l += 1
  else:
    l = 0
  a = max(a, l)
print(a)

Submission status: Accepted

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
if cnt > ans:
    ans = cnt
print (ans)

Submission status: Accepted

Solution code:
S = input()
L = list("ACGT")

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

print(ans)

Submission status: Accepted

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