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:
sentence = input()
#sentence = "ATCODER"

count = 0
maxcount = 0
for i in range(len(sentence)):
	if sentence[i]=="A" or sentence[i]=="T" or sentence[i]=="C" or sentence[i]=="G":
		count += 1
	else:
		count = 0
	if count > maxcount:
		maxcount = count

print(maxcount)

Submission status: Accepted

Solution code:
def resolve():
    acgt = 'ACGT'
    S = input()

    cnt = 0
    max_cnt = 0
    for s in S:
        if s in acgt:
            cnt += 1
            max_cnt = max(max_cnt, cnt)
        else:
            cnt = 0
            
    print(max_cnt)
  
resolve()

Submission status: Accepted

Solution code:
S = input()

# S = 'ATCODER'

ATGC = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}

max = 0
cnt = 0
for i in S:
    if i in ATGC:
       cnt += 1
    else:
        cnt = 0

    if max < cnt:
        max = cnt
print(max)

Submission status: Accepted

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

Submission status: Accepted

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

if c_max < count:
  c_max=count
print(c_max)

Submission status: Accepted

Solution code:
from itertools import combinations

S = input()
cands = [S[i:j] for i, j in combinations(range(len(S)+1), 2)]
ans = 0
for s in cands:
    flag = True
    for c in s:
        if c not in ['A', 'T', 'G', 'C']:
            flag = False
            break
    if flag and ans < len(s):
        ans = len(s)
print(ans)

Submission status: Accepted

Solution code:
S = input()

N = len(S)
ans = 0
for i in range(N):
    for j in range(i + 1, N + 1):
        T = S[i:j]
        flag = True
        for t in set(T):
            if t not in ['A', 'C', 'G', 'T']:
                flag = False
                break
        if flag:
            ans = max(ans, len(T))
print(ans)

Submission status: Accepted

Solution code:
s = input()
a = 0
t = 0
for i in s:
    if i == 'A' or i == 'T' or i == 'G' or i == 'C':
        t += 1
    else:
        if t > a:
            a = t
            t = 0
if t > a:
	a = t
print(a)

Submission status: Accepted

Solution code:
def solve(string):
    ans = 0
    i = 0
    while i < len(string):
        j = 0
        while i + j < len(string) and string[i + j] in "ATGC":
            j += 1
        ans = max(ans, j)
        i += j + 1
    return str(ans)
 
 
if __name__ == '__main__':
    print(solve(input()))

Submission status: Accepted

Solution code:
def solve(string):
    ans = 0
    i = 0
    while i < len(string):
        j = 0
        while i + j < len(string) and string[i + j] in "ATGC":
            j += 1
        ans = max(ans, j)
        i += j + 1
    return str(ans)


if __name__ == '__main__':
    print(solve(input()))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC122B - ATCoder
s = input()
n = len(s)
count = 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]):
            count = max(count, j - i + 1)

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

s = list(input().rstrip())

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

for i in range(len(s)):
    for j in range(4):
        if (s[i] == lis[j]):
            s[i] = 'AYATASO'
            break

ct = 0
ct_lis = []

for i, x in enumerate(s):
    if (x == 'AYATASO'):
        ct += 1
    else:
        ct_lis.append(ct)
        ct = 0

ct_lis.append(ct)

print(max(ct_lis))

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

S = input()

tmp = []
tmp.append(-1)
for i, x in enumerate(S):
	if x != "A" and x != "T" and x != "G" and x != "C":
		tmp.append(i)
tmp.append(len(S))
# print(tmp)
tmp2 = [tmp[i+1]-tmp[i] for i in range(len(tmp)-1)]
print(max(tmp2)-1)

Submission status: Accepted

Solution code:
s=input()
tmpstr=0
maxstr=0
for chara in s:
    if chara=="A" or chara=="C" or chara=="G" or chara=="T":
        tmpstr+=1
        if tmpstr>=maxstr:
            maxstr=tmpstr
    else:
        tmpstr=0
print(maxstr)

Submission status: Accepted

Solution code:
S = input()
atgc = ['A','T','G','C']
flag = True
count = 0
max = 0

for c in S:
  if (c in atgc):
    flag = True
    if not flag:
      count = 0
    count += 1
    if max < count:
      max = count
  else:
    flag = False
    count = 0
    
print(max)

Submission status: Accepted

Solution code:
s = input()
max_len = 0

for i in range(len(s)):
    for j in range(i, len(s)+1):
        s_cut = s[i:j]
        if len(s_cut.replace('A','').replace('C','').replace('G','').replace('T','')) == 0 and len(s_cut) > max_len:
            max_len = len(s_cut)

print(max_len)

Submission status: Accepted

Solution code:
S=input()

c=m=0
for x in S:
  #print((m,c,x,"ACGT".find(x)))
  if "ACGT".find(x)>=0:
    c+=1
    m = max(m, c)
  else:
    c = 0

print(m)

Submission status: Accepted

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

Submission status: Accepted

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

import re

S = re.sub("[ACGT]", "-", input())

for i in range(1, 12):
    if not ("-" * i) in S:
        print(i - 1)
        break

Submission status: Accepted

Solution code:
import sys

S = list(input())

length = 0
maxlen = 0

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

print(maxlen)

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

ans = 0
k = 0
for c in S:
    if c in "ATGC":
        k += 1
    else:
        k = 0
    ans = max(ans, k)
print(ans)

Submission status: Accepted

Solution code:
S = input()
l = []
for i in S:
    l.append(i)

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

#print(cnt)
print(max(cnt))

Submission status: Accepted

Solution code:
S = list(input())
st = [0]*len(S)
string = "ACGT"
for i in range(len(S)):
    if S[i] in string:
        st[i] += 1

st_1 = [1]*len(S)

count = []
temp = 0

for i in range(len(st)):
    if st[i] == st_1[i]:
        temp += 1
    else:
        count.append(temp)
        temp = 0
    if i+1 == len(st):
        count.append(temp)
        
#print(st)
if count:
    print(max(count))
else:
    print(0)

Submission status: Accepted

Solution code:
def main():
  S = input()
  argc = len(S)
  result = 0
  flg = 0
  for i in range(argc):
    if (flg == 0):
      leng = 0
      flg = 1
    if (S[i]=='A')or(S[i]=='C')or(S[i]=='G')or(S[i]=='T'):
      leng = leng + 1
      if leng > result:
        result = leng
    else:
      flg = 0
  print(result)
main()

Submission status: Accepted

Solution code:
s = input()
lenlis = []

for i in range(len(s)):
    cnt = 0
    j = 0
    while (s[i+j]=="A" or s[i+j]=="T" or s[i+j]=="G" or s[i+j]=="C"):
        cnt += 1
        j += 1
        if i+j>=len(s):
            break
    lenlis += [cnt]

print(max(lenlis))

Submission status: Accepted

Solution code:
S = input()

# 右にどれだけの長さのACGT文字列が含まれているか
c = [0 for _ in range(len(S))]

for i in range(len(S)):
    j = 0 # オフセット
    while i + j < len(S) and S[i+j] in ["A", "C", "G", "T"]:
        c[i] += 1
        j += 1
        
print(max(c))

Submission status: Accepted

Solution code:
if __name__ =="__main__":
    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:
a = "ACGT"
S = input()
cnt = 0
ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
s = input()
n = len(s)
A = {"A", "T", "G", "C"}
res = 0
for i in range(n):
    for j in range(i+1, n+1):
        ck = True
        for k in range(i, j):
            if not s[k] in A:
                ck = False
                break
        if ck:
            res = max(res, j-i)

print(res)

Submission status: Accepted

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

i = 0
j = 0
for c in t:
  if c in acgt:
    i += 1
  else:
    j = max(i,j)
    i = 0

print(max(i,j))

Submission status: Accepted

Solution code:
# coding: utf-8

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

count = 0
length = 0

for i in s:
    if i in t:
        count += 1
    elif count > length:
        length = count
        count = 0

print(count) if count > length else print(length)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
str = input()
max = 0
count = 0
for chr in str:
    if chr == 'A' or chr == 'C' or chr == 'G' or chr == 'T':
        count += 1
        if count > max:
            max = count
    else:
        count = 0
print('{}'.format(max))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

S = ''.join(s if s in 'ACGT' else ' ' for s in S)
m = max((len(s) for s in S.split()), default=0)
print(m)

Submission status: Accepted

Solution code:
import re
s = input()
m = re.findall(r"([ACGT]+)", s)
print(len(max(m, key=len)) if m else 0)

Submission status: Accepted

Solution code:
S = input()
max = 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:
        cnt = 0
    if cnt > max:
        max = cnt
print(max)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = [str(i) for i in 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 += 1
        if b > c:
            c = b
    else:
        b = 0

print(c)

Submission status: Accepted

Solution code:
import re
s=input()
s=s.replace("A","1").replace("C","1").replace("G","1").replace("T","1")
s=list(map(int,re.sub('[A-Z]+', ' ', s).split()))
print(0 if s==[] else len(str(max(s))))

Submission status: Accepted

Solution code:
S = input() #入力
m = 0 #最大
n = 0 #現在
a = [] #判別用
for i in range(len(S)):
  if S[i] == "A" or S[i] == "T" or S[i] == "C" or S[i] == "G":
    a.append(1)
  else:
    a.append(0)
for i in range(len(S)):
  if a[i] == 1:
    n += 1
    if n >= m:
      m = n
  else:
    n = 0
print(m)

Submission status: Accepted

Solution code:
s = input()
a = "ATCG"
m = [0]
for i in range(len(s)):
    if s[i] in a:
        j = i + 1
        niz = 1
        while j < len(s) and s[j] in a:
            niz += 1
            j += 1
        m.append(niz)
print(max(m))

# 02:49

Submission status: Accepted

Solution code:
S = input()

allowed = set(list('ATCG'))

ans = 0
curstreak = 0
flag = False

for char in S:
    if char in allowed:

        if flag:
            curstreak += 1
        else:
            flag = True
            curstreak = 1
        
        ans = max(ans, curstreak)

    else:
        if flag:
            flag = False
            curstreak = 0

print(ans)

Submission status: Accepted

Solution code:
s = input()

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

  if c < t:
    c = t

print(c)

Submission status: Accepted

Solution code:
s = input()
char_list = ["A","C","G","T"]
temp = 0
now_max = 0

for char in s:
    if char in char_list:
        temp = temp + 1
    else:
        now_max = max(now_max,temp)
        temp = 0

now_max = max(now_max,temp)
print(now_max)

Submission status: Accepted

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

Submission status: Accepted

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

max_count = 0
interim = 0

while list_s != []:
  for c in list_s:
    if c == 'A' or c =='T' or c == 'C' or c == 'G':
      interim += 1
    else:
      break
  if max_count < interim:
    max_count = interim
  list_s.pop(0)
  interim = 0
  
print (max_count)

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()
b=[]
count=0
for i in range(len(s)):
  if s[i] in "ATCG":
    count+=1
  else:
    b.append(count)
    count=0
b.append(count)
print(max(b))

Submission status: Accepted

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

import re

s = input()

result = re.sub(r'[^ATGC]', ',', s).split(',')

print(max([len(i) for i in result]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
"""
B - ATCoder
https://atcoder.jp/contests/abc122/tasks/abc122_b
"""
if __name__ == '__main__':
    S = str(input())

    length = 0
    answer = 0
    for e in S:
        if e in 'ACGT':
            length += 1
            answer = max(answer, length)
        else:
            length = 0

    print(answer)

Submission status: Accepted

Solution code:
"""
B - ATCoder
https://atcoder.jp/contests/abc122/tasks/abc122_b
"""
if __name__ == '__main__':
    input = str(input())
    i_list = list(input)

    for i, e in enumerate(i_list):
        if e in {'A', 'C','G', 'T'}:
            i_list[i] = '1'
        else:
            i_list[i] = '0'

    c_list = ''.join(i_list).split('0')
    answer = len(max(c_list, key = len))

    print(answer)

Submission status: Accepted

Solution code:
S = str(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())
atcg = "ATCG"
count = 0
count_max = 0
for x in S:
    if x in atcg:
        count += 1
    else:
        if count_max <= count:
            count_max = count
        count = 0

if count_max <= count:
    count_max = count

print(count_max)

Submission status: Accepted

Solution code:
S = str(input())
atcg = "ATCG"
count = 0
count_max = 0
for x in S:
    if x in atcg:
        count += 1
    else:
        if count_max <= count:
            count_max = count
        count = 0
if count_max <= count:
  count_max = count
print(count_max)

Submission status: Accepted

Solution code:
S = input()
flag = 0
count = 0
for i in range(len(S)+1):
    for j in range(i+1, len(S)+1):
        flag = 1
        tmp = S[i:j]
        for k in range(len(tmp)):
            if tmp[k] == 'A' or tmp[k] == 'C' or tmp[k] == 'G' or tmp[k] == 'T':
                flag = 0
            else:
                flag = 1
                break
        if (flag == 0) and len(tmp) > count:
            count = len(tmp)

print(count)

Submission status: Accepted

Solution code:
S = list(input())
N = len(S)
count=0
count_max=0

for i in range(N):
    if S[i] == 'A' or S[i]=='T' or S[i]=='C' or S[i]=='G':
        count = count + 1
        count_max=max(count_max,count)
    else :
        count = 0
        continue

print(count_max)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
n = input()

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

Submission status: Accepted

Solution code:
a = input()
from itertools import groupby

x = lambda x: x in 'ACGT'
print(max(len(list(g)) if k else 0 for k, g in groupby(a, key=x)))

Submission status: Accepted

Solution code:
s=input()
count,max_count=0,0
for t in s:
    if t in ["A","C","G","T"]:
        count+=1
        if max_count<count:
            max_count=count
    else:
        count=0
print(max_count)

Submission status: Accepted

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

S = raw_input()
num = 0
max_num = 0

for s_id in range(len(S)):
    if S[s_id] == 'A' or S[s_id] == 'T' or S[s_id] == 'C' or S[s_id] == 'G':
        num += 1
    else:
        if num != 0 and max_num < num:
            max_num = num
            num = 0

    if s_id == len(S) - 1 and num != 0 and max_num < num:
        max_num = num

print '{}'.format(max_num)

Submission status: Accepted

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

Submission status: Accepted

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

length = len(S)
ans = 0
tmp = 0

for i in range(length):
  if S[i] in gene:
    tmp += 1
  else:
    tmp = 0
  if tmp >= ans:
    ans = tmp
print(ans)

Submission status: Accepted

Solution code:
import sys
T = sys.stdin.readline().rstrip('\n')
s = ['A','C','G','T']

out = 0
tmp = 0

l = len(T)

for i in range(l):
	if T[i] in s:
		tmp += 1
	else:
		tmp = 0

	if tmp >= out:
		out = tmp

print (out)

Submission status: Accepted

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

length = len(s)
ans = 0
tmp = 0
for i in range(length):
    if s[i] in gene:
        tmp += 1
    else:
        tmp = 0
    
    if tmp >= ans :
        ans = tmp

print(ans)

Submission status: Accepted

Solution code:
s=list(input())

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

if s.count(1) == 0:
  print(0)
  exit()

n=0
for i in range(len(s)):
  if s[i] == 1:
    s[i]=n
    n += 1
  else:
    n = 0
    s[i]=n

print(max(s)+1)

Submission status: Accepted

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

ans = 0
i = 0

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

Submission status: Accepted

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

ichi_list.append(counter)
print(max(ichi_list))

Submission status: Accepted

Solution code:
s = list(input())

res = 0
max = 0
for i in s:
  if i == 'A' or i == 'T' or i == 'C' or i == 'G':
    res += 1
  elif max <res:
    max = res
    res = 0
  else:
    res = 0

if max < res:
  max = res

print(max)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
b=input()
max = 0
count = 0

for i in range(len(b)):
    if b[i] == 'A':
        count += 1
    elif b[i] == 'C':
        count += 1
    elif b[i] == 'G':
        count += 1
    elif b[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()
mojiretsu = ["A","C","G","T"]
s_bin = [int(s in mojiretsu) for s in S]
# print(s_bin)
cnt = 0
cnt_max = 0
for s in s_bin+[0]:
    if s == 0:
        # cnt_max = max(cnt_max, cnt)
        cnt = 0
    if s == 1:
        cnt += 1
        cnt_max = max(cnt_max, cnt)
    
    # print("s:{},cnt:{},cnt_max{}".format(s,cnt,cnt_max))

print(cnt_max)

Submission status: Accepted

Solution code:
# coding: utf-8

l = list(input())
counter = 0
atcorder = []


for i in range(len(l)):
    if(l[i] == "A" or l[i] == "T" or l[i] == "G" or l[i] == "C"):
        counter += 1
        atcorder.append(counter)
        continue

    counter = 0


if(len(atcorder) != 0):
    print(max(atcorder))
else:
    print("0")

Submission status: Accepted

Solution code:

arg=input()
x=len(arg)
count=0
d=[0]

for i in arg:
    if(i=="A" or i=="C" or i=="G" or i=="T"):
        count=count+1
        d.append(count)
    else:
        count=0

print(max(d))

Submission status: Accepted

Solution code:
S=str(input())
cnt=0
maxcnt=0
for i in S:
    if(i=="A" or i=="C" or i=="G" or i=="T"):
        cnt+=1
    else:
        if(maxcnt<cnt):
            maxcnt=cnt
        cnt=0
if(maxcnt<cnt):
    maxcnt=cnt
print(maxcnt)

Submission status: Accepted

Solution code:
S = str(input())
counter = 0
max = 0

for i in S:
    if i == 'A' or i == 'T' or i == 'C' or i == 'G':
        counter += 1
        if counter >= max:
            max = counter
    else:
        counter = 0

print(max)

Submission status: Accepted

Solution code:
str = input()

max = 0
cnt = 0
for i in str:
  if (i == 'A' or i == 'C' or i == 'G' or i == 'T'):
    cnt += 1
    if (cnt >= max):
      max = cnt
  else:
    cnt = 0

print(max)

Submission status: Accepted

Solution code:
s = list(input())

L = []
cnt = 0

for x in s:
    if x == "A" or x == "C" or x == "G" or x == "T":
        cnt += 1
    else:
        L.append(cnt)
        cnt = 0
L.append(cnt)

print(max(L))

Submission status: Accepted

Solution code:
s = input()
t = [-1]

for i in range(len(s)):
    if s[i] != "A" and s[i] != "G" and s[i] != "C" and s[i] != "T":
        t.append(i)
t.append(len(s))

ans = 0
for j in range(len(t) - 1):
    x = t[j+1] - t[j] - 1
    if x > ans:
        ans = x

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

def i2s():
    return sys.stdin.readline().rstrip()

def ii2ss(n):
    return [sys.stdin.readline() for _ in range(n)]

def sp2nn(sp, sep=' '):
    return [int(s) for s in sp.split(sep)]

def ss2nn(ss):
    return [int(s) for s in list(ss)]

def main(S):
    st = set(('A', 'C', 'G', 'T'))
    cmax = 0
    c = 0
    for s in S:
        if s in st:
            c += 1
        else:
            if cmax < c:
                cmax = c
            c = 0
    if cmax < c:
        cmax = c
    print(cmax)

main(i2s())

Submission status: Accepted

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

Submission status: Accepted

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

for let in s:
  if let == "A" or let == "T" or let == "G" or let == "C":
    i += 1
  else:
    ans.append(i)
    i = 0
ans.append(i)    
print(max(ans))

Submission status: Accepted

Solution code:
S = (input())
k=0
j=0
for  chr in S:
    if (chr=='A')or(chr=='C')or(chr=='G')or(chr=='T'):
        j=j+1
    else:
        if k<j:
            k=j
        j=0
if k<j:
    k=j
print(k)

Submission status: Accepted

Solution code:
a=input()
k=0
ans=0
for b in a:
    if (b=='A')or(b=='C')or(b=='G')or(b=='T'):
        k=k+1
    
    else:
        if ans<k:
            ans=k
        k=0
if ans<k:
	ans=k
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
acgt=["A", "C", "G", "T"]
s=list(raw_input())
a=[-1]
maxL=0
for pos in range(len(s)):
   if s[pos] not in acgt:
       a.append(pos)
a.append(len(s))
for pos in range(1,len(a)):
   L=a[pos]-a[pos-1]-1
   if L>maxL:
       maxL=L
print(maxL)

Submission status: Accepted

Solution code:
print(len(max("".join(str(int(c in"ATGC"))for c in input()).split("0"))))

Submission status: Accepted

Solution code:
print(len(max("".join(str(int(c in{"A","T","G","C"}))for c in input()).split("0"))))

Submission status: Accepted

Solution code:
s=input()
count=0
count_list=[]
seq=["A","T","G","C"]
for base in s:
    if base in seq:
        count +=1
    else:
        count_list.append(count)
        count = 0
    count_list.append(count)
print(max(count_list))

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('AGCT'.count(c) for c in s[i:j+1]):
      ans = max(ans, j-i+1)
print(ans)

Submission status: Accepted

Solution code:
a=str(input())
b=len(a)
x=0
y=0
for i in range(b):
    if a[i]=="A" or a[i]=="T" or a[i]=="G" or a[i]=="C":
        x +=1
    else:
        x=0
    if (x > y):
        y=x
print(y)

Submission status: Accepted

Solution code:
#!/usr/bin/python
# -*- Coding: utf-8 -*-

def main():
    sample = raw_input()
    arr = []
    length = 0
    ans = 0
    for s in sample:
        arr.append(s)
    for t in arr:
        if t == 'A' or t == 'C' or t == 'G' or t == 'T':
            length += 1
        else:
            if ans < length:
                ans = length
                length = 0
    if ans < length:
        ans = length
        length = 0
    return ans

print(main())

Submission status: Accepted

Solution code:
ref=input()
count=0
count_list=[]
seq=["A","T","G","C"]
for base in ref:
    if base in seq:
        count +=1
       
    else:
        count_list.append(count)
        count =0
    count_list.append(count)

print(max(count_list))

Submission status: Accepted

Solution code:
s=str(input())
count=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':
    count += 1
  else:
    count=0
  if count>tmp:
    tmp=count
print(tmp)

Submission status: Accepted

Solution code:
s = str(input())
a = "ACGT"
count = 0
b = []
for i in s:
  if i in a:
    count += 1
    b.append(count)
  else:
    b.append(count)
    count = 0
print(max(b))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
string = input().strip()

longest = 0
current = 0

for s in string:
    if s in ('A', 'T', 'G', 'C'):
        current += 1
        if current > longest:
            longest = current
    elif current > 0:
        current = 0

print(longest)

Submission status: Accepted

Solution code:
a = list(input())
b = ""
c = ""
for i in range(len(a)):
  if(a[i] == "A" or a[i] == "G" or a[i] == "T" or a[i] == "C"):
    b += a[i]
    if(len(b)>len(c)):
      c = b
  else:
      b = ""
print(len(c))

Submission status: Accepted

Solution code:
a = list(input())
b = 0
c = 0

for i in range(len(a)):
  if(a[i] == "A" or a[i] == "G" or a[i] == "T" or a[i] == "C"):
    b += 1
    if(b > c):
      c = b
  else:
    b = 0

print(c)