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:
import sys
input=sys.stdin.readline().strip

#N, Q = list(map(int, input().split()))
T = input()
ACGT = set(["A", "C", "G", "T"])
num = 0
nummax = 0
for i in range(len(T)):
	if T[i] in ACGT:
		num += 1
		nummax = max(nummax, num)
	else:
		num = 0

print(nummax)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())

length = []
temp = 0
for i in S:
    if (i == "A") or (i == "T") or (i == "G") or (i == "C"):
        temp += 1
        length.append(temp)
    else:
        length.append(0)
        temp = 0

print(max(length))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
l = list(str(input()))
for i in range(len(l)):
    if l[i] == 'A' or l[i] == 'T' or l[i] == 'C' or l[i] == 'G':
        pass
    else:
        l[i] = ','
ll = "".join(l).split(',')
ans = max(len(ll[i]) for i in range(len(ll)))
print(ans)

Submission status: Accepted

Solution code:
#B - ATCoder(ABC122)
S=input()
A=[]
c=0
for i in range(len(S)+1):
    for v in range(1,len(S)+1):
        A.append(c)
        c=0
        for s in S[i:v]:
            if s=="A"or s=="C" or s=="G" or s=="T":
                c+=1
            else:
                break
print(max(A))

Submission status: Accepted

Solution code:
N=list(input())
count = 0
Scount = 0

for i in N:
  if i == "A" or i == "C" or  i == "G" or  i == "T":
    count += 1
    Scount = max(Scount,count)
  else:
    count = 0

print(Scount)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import os,re,sys,operator,math
from collections import Counter,deque
from operator import itemgetter
from itertools import accumulate,combinations,groupby
from sys import stdin,setrecursionlimit
from copy import deepcopy
import heapq
import string

setrecursionlimit(10**6)

s=stdin.readline().rstrip()
t="AGTC"
cnt,ans=0,0
for i in s:
    if i in t:
        cnt+=1
    else:
        ans=max(ans,cnt)
        cnt=0
ans=max(ans,cnt)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
A = [-2, -1]
for i in range(len(S)):
    A += [i]*(S[i] not in "ACGT")
A += len(S),
print(max([b-a for a, b in zip(A, A[1:])])-1)

Submission status: Accepted

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

Submission status: Accepted

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

ans = max(ans, k)
print(ans)

Submission status: Accepted

Solution code:
s = input()

ans = 0
cnt = 0
for c in s:
    if c in "ATCG":
        cnt += 1
        ans = max(ans, cnt)
    else:
        cnt = 0

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=list(input())
cnt=[0 for _ in range(len(s))]
k=0
for i in range(len(s)):
    if(s[i]=="A" or s[i]=="G" or s[i]=="C" or s[i]=="T" ):
        cnt[k]+=1
    else:
        k+=1

print(max(cnt))

Submission status: Accepted

Solution code:
s = input()

ans = 0
cnt = 0
for c in s:
    if c in "ATCG":
        cnt += 1
    else:
        cnt = 0
    ans = max(ans, cnt)

print(ans)

Submission status: Accepted

Solution code:
print(max([sum(1 for _ in s[1]) if s[0] == 'A' else 0 for s in __import__('itertools').groupby(input().replace('T', 'A').replace('G', 'A').replace('C', 'A'))]))

Submission status: Accepted

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

check_list = ['*' if char in acgt else '/' for char in s]
acgt_list = ''.join(check_list).split('/')
answer = max([len(x) for x in acgt_list])
print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from re import findall
S = input()
f = findall('[ACGT]*',S)
l = map(len, f)
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:
s = input()
a = ["A", "G", "C", "T"]
ma = 0
for i in range(len(s)):
    if s[i] in a:
        cnt = 1
        ma = max(ma, cnt)
        for j in range(i+1, len(s)):
            if s[j] in a:
                cnt += 1
                ma = max(ma, cnt)
            else:
                break
print(ma)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=list(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:
    count=0
  if max_<count:
      max_=count
print(max_)

Submission status: Accepted

Solution code:
s = list( input() )

max_cnt = 0
cnt = 0
for c in s:
    if c == 'A' or c == 'C' or c == 'G' or c == 'T':
        cnt += 1
        if max_cnt < cnt:
            max_cnt = cnt
    else:
        cnt = 0

print(max_cnt)

Submission status: Accepted

Solution code:
S = input()
maxlen = 0
top = 0
while top < len(S):
    c = top
    while c < len(S):
        if S[c] == 'A' or S[c] =='C' or S[c] == 'G' or S[c] == 'T':
            c += 1
        else:
            break
    if maxlen < c - top:
        maxlen = c - top
    top = c + 1

print(maxlen)

Submission status: Accepted

Solution code:
S = input()
ACGT=["A","C","G","T"]
for i in range(len(S)):
  if not S[i] in ACGT:
    S = S.replace(S[i],"-")
print(max(map(len,S.split("-"))))

Submission status: Accepted

Solution code:
import re

s = input()

results = re.findall(r'[ACGT]*', s)
print(max([len(r) for r in results]))

Submission status: Accepted

Solution code:
s=input()

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

Submission status: Accepted

Solution code:
s=input()

sub=list(s)

count=0
max=-1

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

if max!=-1:
    print(max)
else:
    print(0)

Submission status: Accepted

Solution code:
import math
import copy

inputa = input().split()
# inputb = input().split()
# inputc = input().split()

# a = int(inputa[0])
# b = int(inputa[1])
# c = int(inputa[2])

a = inputa[0]
inputList = list(a)

# x = int(inputb[0])
# y = int(inputb[1])

# inputList=[]
# for i in range(a):
#     inputNum = input()
#     inputList.append(inputNum)
#
# inputList = [int(n) for n in inputList]

# b = [int(n) for n in inputb]
# c = [int(n) for n in inputc]

sum = 0
max = 0
ref = ["A", "C", "G", "T"]
for i in range(len(inputList)):
    flg = False
    for j in range(len(ref)):
        if inputList[i] == ref[j]:
            flg = True
            break

    if flg == False:
        if sum > max:
            max = sum
        sum = 0
    elif flg == True and i == len(inputList)-1:
        sum +=1
        if sum > max:
            max = sum
    elif flg == True:
        sum += 1
        
print(max)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

c = 0
m = 0
for i in s:
	if i in 'ACGT':
		c += 1
		m = max(c,m)
	else:
		c = 0

print(m)

Submission status: Accepted

Solution code:
s=input()
a=0
b=["A","C","G","T"]
k=0
for i in range(len(s)):
    if s[i] in b:
        k+=1
        if i==len(s)-1 and k>a:
            a=k
    else:
        if k>a:
            a=k
        k=0

print(a)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

S = input()
array = ["A", "C", "G", "T"]
ctr, max_ctr = 0, 0

for i in range(len(S)):
    if S[i] in array:
        ctr += 1
        if max_ctr < ctr:
            max_ctr = ctr
    else: ctr = 0
    
print(max_ctr)

Submission status: Accepted

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

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

print(maximum)

Submission status: Accepted

Solution code:
s = input()
l = ['A', 'T', 'C', 'G']
r = 0
m = 0
for x in range(len(s)):
    if s[x] in l:
        r += 1
    elif r > 0:
        r = 0
    if m < r:
        m = r
print(m)

Submission status: Accepted

Solution code:
def solve():
    s = input()
    genom = ["A", "T", "G", "C"]
    count, ans = 0, 0
    for c in s:
        if c in genom:
            count += 1
            if count > ans:
                ans = count
        else:
            count = 0
    print(ans)


if __name__ == "__main__":
    solve()

Submission status: Accepted

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

m = ''.join(ans)
m2 = m.split('0')
mx = max(m2)
print(len(mx))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

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

i = 0
max = 0

while len(S) > i:
    count = 0
    for j in range(i,len(S)):
        hantei = 0
        for k in range(4):
            if S[j] == ACGT[k] :
                count += 1
                hantei = 1
                break
        if hantei == 0:
            break     
    if max < count:
        max = count
    i += 1

print(max)

Submission status: Accepted

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

max_length = 0
for i in range(len(S)):
  if S[i] in list:
    for j in range(i, len(S)):
      s = S[j]
      if s not in list:
        break
      else:
        str = S[i:j+1]
        if len(str) > max_length:
          max_length = len(str)

print(max_length)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

acgt_num = 0
answer = 0
for i in range(len(s)):
    for j in range(4):
        if s[i] == acgt[j]:
            acgt_num += 1
            if i == len(s) - 1 and acgt_num > answer:
                answer = acgt_num
            break
        elif j == 3:
            if acgt_num > answer:
                answer = acgt_num
            acgt_num = 0

print(answer)

Submission status: Accepted

Solution code:
import re
print(max(map(len, re.split('[^ACGT]',input()))))

Submission status: Accepted

Solution code:
s = list(input())

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

print(max(cnt))

Submission status: Accepted

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

Submission status: Accepted

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

mm = 0
m = 0
for c in s:
    if c in a:
        m += 1
        mm = max(mm,m)
    else:
        m = 0

print(mm)

Submission status: Accepted

Solution code:
S=str(input())
N=len(S)
l,r=0,0
ans=0
while r<N:
	if S[r]=='A' or S[r]=='T' or S[r]=='C' or S[r]=='G':
		r=r+1
		ans=max(ans,r-l)
	else:
		l=r+1
		r=r+1
print(ans)

Submission status: Accepted

Solution code:
S = input()
N = len(S)
ans = 0
for l in range(N):
  i = 0
  while l + i < N and S[l + i] in ['A', 'T', 'G', 'C']:
    i += 1
  ans = max([ans, i])
print(ans)

Submission status: Accepted

Solution code:
s = input()

maxV = 0
length = 0
isChecking = False

for i in range(len(s)):
    if isChecking:
        if s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T':
            length += 1
            if length > maxV:
                maxV = length
        else:
            isChecking = False
    else:
        if s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T':
            isChecking = True
            length = 1
            if length > maxV:
                maxV = length

print(maxV)

Submission status: Accepted

Solution code:
s=list(input())
cnt=0
ans=0
l=list("ATCG")
 
for i in s:
    if i in l:
        cnt+=1
        ans=max(ans,cnt)
    else:
        cnt=0
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())
l = len(S)
ans = 0
for i in range(l - 1):
  if S[i] == "A" or S[i] == "T" or S[i] == "G" or S[i] == "C":
    L = 1
    for j in range(i + 1, l):
      if S[j] == "A" or S[j] == "T" or S[j] == "G" or S[j] == "C":
        L += 1
      else:
        ans = max(ans, L)
        i = j
        break
    ans = max(ans, L)
if S[l - 1] == "A" or S[l - 1] == "T" or S[l - 1] == "G" or S[l - 1] == "C":
  L = 1
  ans = max(ans, L)
print(ans)

Submission status: Accepted

Solution code:
s=str(input())
a=0
b=0
for i in range(len(s)):
        if s[i] in 'AGCT':
                a+=1
        else:
                b=max(a,b)
                a=0
print(max(a,b))

Submission status: Accepted

Solution code:
s=str(input())

l=[]
for i in range(len(s)):
        if s[i] == 'A':
                continue
        elif s[i] =='T':
                continue
        elif s[i] =='C':
                continue
        elif s[i] =='G':
                continue
        else:
                l.append(i)


if l==[]:
        print(len(s))
else:
        ans=l[0]
        l.append(len(s))
        for j in range(len(l)-1):
                if l[j+1]-l[j]-1>=ans:
                        ans=l[j+1]-l[j]-1
        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):
        for k in range(i,j+1):
            a = s[k]
            if a!='A' and a!='C' and a!='G' and a!='T':
                break
            if k==j:
                ans=max(ans,j-i+1)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

S = input()
ACGT = list('ACGT')

last_max = 0
ret = 0
for c in S:
    if c in ACGT:
        ret += 1
    elif ret > 0:
        last_max = max(ret, last_max)
        ret = 0

print(max(ret, last_max))

Submission status: Accepted

Solution code:
s=list(input())
cnt=0
ans=0
l=list("ATCG")
 
for i in s:
    if i in l:
        cnt+=1
        ans=max(ans,cnt)
    else:
        cnt=0
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

count = 0
record = 0

for s in S:
  if s == "A" or s == "T" or s == "G" or s == "C":
    count += 1
  else:
    count = 0
  if record < count:
    record = count
    
print(record)

Submission status: Accepted

Solution code:
s = input()
lm = list("ACGT")
ml = 0
cnt = 0
for i in range(len(s)):
    if s[i] in lm:
        cnt += 1
        ml = max(ml, cnt)
    else:
        cnt = 0
print(ml)

Submission status: Accepted

Solution code:
S = input()
r = 0
L = []
for c in S:
  if c == "A" or c == "C" or c == "G" or c == "T":
    r += 1
  else:
    L.append(r)
    r = 0
L.append(r)
print(max(L))

Submission status: Accepted

Solution code:
# coding: utf-8
# submission # - User: herp_sy
# https://atcoder.jp/contests/

import math
import statistics

s = input()
length = 0
ans = 0
for ch in s:
    if ch in ('A','C','G','T'):
        length += 1
        ans = max(ans, length)
    else:
        length = 0
print(ans)

Submission status: Accepted

Solution code:
s=list(input())
cnt=0
ans=0
lis=list("ATCG")

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

Submission status: Accepted

Solution code:
a = input()
b = 0
c = list("ACGT")
for i in range(len(a)):
    if a[i] in c:
        b = max(b, 1)
        for j in range(i + 1, len(a)):
            if a[j] in c:
                b = max(b, j - i + 1)
            else:
                break
print(b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
a = ["A","T","G","C"]
b = []
n = len(s)
for i in range(n):
    if s[i] in a:
        b.append(1)
    else:
        b.append(0)

for i in range(1,n):
    if b[i]>0:
        b[i] = b[i-1] + 1

print(max(b))

Submission status: Accepted

Solution code:
S = input()
x = ["A","C","G","T"]
for i in range(len(S)):
    if not S[i] in x:
        S = S[:i] + "0" + S[i+1:]
S = S.split("0")
print(max(len(i) for i in S))

Submission status: Accepted

Solution code:
import re
s=str(input())
s=re.split('[^ACGT]',s)

ans=0
for i in range(len(s)):
    ans=max(ans,len(s[i]))

print(ans)

Submission status: Accepted

Solution code:


str = input()
acgt = set({'A','C','G','T'})

max_len = 0
work_len = 0
for c in str:
    if c in acgt:
        work_len += 1
    else:
        if max_len < work_len:
            max_len = work_len
        work_len = 0
if work_len > max_len:
    max_len = work_len
print(max_len)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
s = input()

acgt = {'A', 'T', 'G', 'C'}

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

print(max)

Submission status: Accepted

Solution code:
s=input()
c=0
an=0

for i in s:
    if i in "ACGT":
        c+=1
        an = max(an,c)
    else:
        c=0

print(an)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

target = "ACGT"
max_len = 0
tmp_len = 0

for i in range(len(s)):
    if s[i] in target:
        tmp_len += 1
    else:
        max_len = max(tmp_len, max_len)
        tmp_len = 0
max_len = max(tmp_len, max_len)
print(max_len)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = list(input())

max = 0
length = 0

for i in range(len(s)):
    if s[i] == 'A' or s[i] == 'T' or s[i] == 'G' or s[i] == 'C':
        length += 1
        if max < length:
            max = length
    else:
        length = 0

print(max)

Submission status: Accepted

Solution code:
s = list(input())

a = set(['A', 'C', 'G', 'T'])

buf = 0
temp = [0]
for i in s:
    if i in a:
        buf += 1
        temp.append(buf)
    else:
        buf = 0

print(max(temp))

Submission status: Accepted

Solution code:
s = input()
acgt = {'A', 'C', 'G', 'T'}
count = 0
temp_list= []

for c in s:
  if c in acgt:
    count += 1
  else:
    count = 0
  
  temp_list.append(count)
  
print(max(temp_list))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    S = input()
    ans = 0
    for i in range(len(S)):
        for j in range(len(S)+1):
            ans = max(ans, cal_ACGT(S[i:j]))
    print(ans)

def cal_ACGT(substr):
    if (is_ACGT(substr)):
        return len(substr)
    else:
        return 0

def is_ACGT(substr):
    flag = []
    for i in range(len(substr)):
        if(substr[i] == "A"):flag.append(True)
        elif(substr[i] == "C"):flag.append(True)
        elif(substr[i] == "G"):flag.append(True)
        elif(substr[i] == "T"):flag.append(True)
        else:flag.append(False)
    return all(flag)

main()

Submission status: Accepted

Solution code:
s=input()

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

for i in range(n):
	if s[i]=='A' or s[i]=='T' or s[i]=='G' or s[i]=='C':
		ac[i+1]=ac[i]+1

print(max(ac))

Submission status: Accepted

Solution code:
s = input()
c = []
cnt = 0

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

Submission status: Accepted

Solution code:
moji_list = input()
ADGT = ["A","C","G","T"]

def count(moji_list,i,cnt,ADGT):
  while moji_list[i] in ADGT:
    cnt+=1
    if i+1 == len(moji_list):
      break
    i+=1
    
  return cnt

cnt_list = []
for i in range(len(moji_list)):
  cnt=0
  cnt_list.append(count(moji_list,i,cnt,ADGT))
  
print(max(cnt_list))

Submission status: Accepted

Solution code:
#ABC 122, B - ATCoder
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 = list(str(input()))

count = 0
ACGT = ["A","C","G","T"]
tmp_max = [0]

if all(s) in ACGT:
	print(len(s))
else:
	for letter in s:
		if letter in ACGT:
			count += 1
		else:
			tmp_max.append(count)
			count = 0
	tmp_max.append(count)
	print(max(tmp_max))

Submission status: Accepted

Solution code:
sss = [i for i in input()]
check = ["A","C","G","T"]
ans = 0 
temp_ans = 0
for s in sss:
  if s in check:
    temp_ans += 1
  else:
    if ans < temp_ans:
      ans = temp_ans
    temp_ans = 0
if ans < temp_ans:
  ans = temp_ans
print(ans)

Submission status: Accepted

Solution code:
import re

S = input()
l = re.findall(r'[ACGT]+', S)
print(max(map(len, l), default=0))

Submission status: Accepted

Solution code:
import re

S = input()
l = re.findall(r'[ACGT]+', S)
print(max(map(len, l)) if l else 0)

Submission status: Accepted

Solution code:
import re

S = input()
l = re.findall(r'[ACGT]+', S)
if l:
  print(max(map(len, l)))
else:
  print(0)

Submission status: Accepted

Solution code:
S = input()

count = 0
max_count = 0
for i in S:
    if i in ('A', 'T', 'C', 'G'):
        count += 1
    else:
        if count > max_count:
            max_count = count
        count = 0

if count > max_count:
    max_count = count

print(max_count)

Submission status: Accepted

Solution code:
S = input()
count, max_count = 0, 0
for s in S:
  if s in 'ACGT':
    count += 1
    if count > max_count:
      max_count = count
  else:
    count = 0
print(max_count)

Submission status: Accepted

Solution code:
s=input();cnt=m=0
for i in s:
  if i in "ACGT":
    cnt+=1;m=max(m,cnt)
  else:cnt=0
print(m)

Submission status: Accepted

Solution code:
S = str(input())
ans = 0
count = 0
ACGT = ["A","G","C","T"]
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()
t = "ATGC"

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

print(ans)

Submission status: Accepted

Solution code:
def solve():
    S = input()
    S = S+'*' # 終端文字
    max_sub = 0
    sub_length = 0
    for s in S:
        if s in 'ACGT':
            sub_length += 1
        else: 
            max_sub = max(max_sub, sub_length)
            sub_length = 0
        
    print(max_sub)
    
solve()

Submission status: Accepted

Solution code:
s = input()
correct_list = ["A","C","G","T"]
x_list = [-1]

for i, c in enumerate(s):
    if c not in correct_list:
        x_list.append(i)
x_list.append(len(s))
diff_list = []
for i in range(len(x_list)-1):
    diff_list.append(x_list[i+1]-x_list[i])
print(max(diff_list)-1)

Submission status: Accepted

Solution code:

s=input()

c = set("ACGT")
res = 0
for i in range(0, len(s)):
    for j in range(i,len(s)):
        t = s[i:j+1]
        u = len(t)
        t = set(t)
        if t | c == c:
            res = max(res, u)

print(res)

Submission status: Accepted

Solution code:
# ATCoder
S = input()

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

print(cnt_max)

Submission status: Accepted

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