Problem:


Score : 200 points

Problem Statement

You are given a string S consisting of uppercase English letters. Find the length of the longest ACGT string that is a substring (see Notes) of S.

Here, a ACGT string is a string that contains no characters other than A, C, G and T.

Notes

A substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.

For example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and  (the empty string), but not AC.

Constraints

S is a string of length between 1 and 10 (inclusive).

Each character in S is an uppercase English letter.

Input

Input is given from Standard Input in the following format:

S

Output

Print the length of the longest ACGT string that is a substring of S.

Sample Input 1

ATCODER

Sample Output 1

3

Among the ACGT strings that are substrings of ATCODER, the longest one is ATC.

Sample Input 2

HATAGAYA

Sample Output 2

5

Among the ACGT strings that are substrings of HATAGAYA, the longest one is ATAGA.

Sample Input 3

SHINJUKU

Sample Output 3

0

Among the ACGT strings that are substrings of SHINJUKU, the longest one is  (the empty string).



Sample input:
ATCODER


Sample output:
3

Submission status: Accepted

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

for e in s:
    if e in "ACGT":
        cnt += 1
    else:
        if cnt > ans:
            ans = cnt
        cnt = 0

if cnt > ans:
    ans = cnt
print(ans)

Submission status: Accepted

Solution code:
T = input()+"Z"  #T=ATCODERZ
x=["A","C","G","T"]
count=0
stock=[]

for i in range(len(T)):
  if T[i] in x:
    count += 1
  else:
    stock.append(count)
    count = 0

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

Submission status: Accepted

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

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:
        ans = max(ans, tmp)
        tmp = 0
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
import re
l = re.split('B|D|E|F|H|I|J|K|L|M|N|O|P|Q|R|S|U|V|W|X|Y|Z', s)
print(max([len(i) for i in l]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
from itertools import combinations

s = stdin.readline().rstrip()

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

count = 0
saikou = 0

for i in s:
    if i in li:
        count += 1
        saikou = max(saikou,count)
    else:
        count = 0
        
print(saikou)

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(len(S)):
    res = 0
    if S[i] in acgt:
        while (i < len(S)) and (S[i] in acgt):
            res += 1
            i += 1
        ans = max(ans, res)
print(ans)

Submission status: Accepted

Solution code:
s = input()
l = ['A', 'T', 'G', 'C']
ans = 0
cnt = 0
for c in s:
  if c in l:
    cnt += 1
  else:
    if cnt > ans:
      ans = cnt
    cnt = 0
if cnt > ans:
  ans = cnt
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):
		s = S[i:j]
		ok = True
		for k in range(len(s)):
			if s[k] not in {'A', 'C', 'G', 'T'}: ok = False
		if ok: ans = max(ans, j - i)
print(ans)

Submission status: Accepted

Solution code:
S = list(input())

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = "".join([i if i in 'ACGT' else ' ' for i in input()])
print(max([len(i) for i in S.split()]+[0]))

Submission status: Accepted

Solution code:
import re

s=input()

matched = re.findall(r'[ATGC]+',s)
ans=0

for i in matched:
    ans=max(ans,len(i))
    
print(ans)

Submission status: Accepted

Solution code:
S = list(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
        if ans < cnt:
            ans=cnt
    else:
        cnt=0
        
print(ans)

Submission status: Accepted

Solution code:
import re
s = input()
matched = re.findall(r'[ATGC]+', s)
res = 0
for m in matched:
    res = max(res, len(m))
print(res)

Submission status: Accepted

Solution code:
S = str(input())

count = 0
X =[]
for n in range(len(S)):
    if n != len(S) -1:
        if S[n] == 'A' or S[n] == 'T' or S[n] == 'C' or S[n] == 'G':
            count += 1
        else:
            X.append(count)
            count = 0
    else:
        if S[n] == 'A' or S[n] == 'T' or S[n] == 'C' or S[n] == 'G':
            count += 1
            X.append(count)
        else:
            X.append(count)
print(int(max(X)))

Submission status: Accepted

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

cnt = 0
mx = 0
for i in range(len(s)):
	if s[i] in lst:
		cnt += 1
	else:
		if mx < cnt:
			mx = cnt
		cnt = 0
if mx < cnt:
	mx = cnt
print(mx)

Submission status: Accepted

Solution code:
import sys
S = input()
N = len(S)
ans = 0
x = 0
for i in range (0,N):
  if (S[i] == "A") or (S[i] == "T") or (S[i] == "C") or (S[i] == "G"):
    x = x + 1
  else:
    ans = max(x,ans)
    x = 0
  if i == N-1:
    ans = max(x,ans)
    print(ans)
    sys.exit()

Submission status: Accepted

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

Submission status: Accepted

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

counter = 0
ans_L = []
for val in s:
    if val in L:
        counter += 1
    else:
        ans_L.append(counter)
        counter = 0
ans_L.append(counter)

print(max(ans_L))

Submission status: Accepted

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

def main():
    S = input()
    max_ACGT_length = 0
    for start in range(len(S)):
        if not (ACGT(S[start])):
            continue
        ACGT_length = 1
        for index in range(start+1,len(S)):
            if ACGT(S[index]):
                ACGT_length += 1
            else:
                break
        if ACGT_length > max_ACGT_length:
            max_ACGT_length = ACGT_length

    print(max_ACGT_length)

def ACGT(chr):
    return (chr == 'A' or chr == 'C' or chr == 'G' or chr == 'T')

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
S = input()

partial = ""

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

conlist = []

con = 0

for i in range(0,len(S)):
	if S[i] in conditions:
		for j in range(0,i+1):
			if S[j] in conditions:
				con +=1
			if (S[j] not in conditions) or j == i:
				conlist.append(con)
				con = 0
				

if len(conlist) > 0:
	print(max(conlist))
else:print(0)

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=str(input())
ans=0
counter=0
for i in s:
	if "A" == i: counter+=1
	elif "C" == i: counter+=1
	elif "G" == i: counter+=1
	elif "T" == i: counter+=1
	else: counter=0
	ans=max(ans,counter)
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,j-i+1)

print(ans)

Submission status: Accepted

Solution code:
s=str(input())

lens=len(s)
ans=0
list=[]

for i in range(lens):
	if (s[i]=='A')|(s[i]=='T')|(s[i]=='C')|(s[i]=='G'):
		ans=ans+1
	else:
		list.append(ans)
		ans=0
list.append(ans)
print(max(list))

Submission status: Accepted

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

for i in S:
    ans = max(ans, count)
    if i in acgt:
        count += 1
    else:
        count = 0

print(max(ans, count))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = open(0).read()
N = len(S)
ans = 0

for i in range(N):
    for j in range(i, N):
        judge_list = ['ACGT'.count(c) for c in S[i : j + 1]]
        #print(judge_list)
        if all(judge_list):
            ans = max(ans, j - i + 1)
print(ans)

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:
s=input()
ans=0
start=-1
for i in range(len(s)):
    if not s[i] in "ACGT":
        ans=max(ans,i-start-1)
        start=i
    i+=1
ans=max(ans,i-start-1)
print(ans)

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
S = input() + '#'
M = 0
ret = 0
for s in S :
    if s in 'AGCT' :
        ret += 1
    else :
        M = max(M, ret)
        ret = 0
print(M)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = list(input())
answer = 0
count = 0
ACGT = ["A","C","G","T"]
for c in s:
    if c in ACGT:
        count += 1
    else:
        if answer < count:
            answer = count 
        count = 0
print(max(answer,count))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
S = list(input())

count = 0
max_count = 0

if len(S) == 1:
    if S[0] == 'A' or \
        S[0] == 'C' or \
        S[0] == 'G' or \
        S[0] == 'T':
        print("1")
        exit()
    else:
        print("0")
        exit()


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 count > max_count:
            max_count = count
        count = 0

if count > max_count:
    max_count = count

print(max_count)

Submission status: Accepted

Solution code:
S=list(str(input()))
lst=['A','T','G','C']
N=len(S)
s=0
ans=0
def dp(s,ans):
  if s==N-1:
    return ans
  tmp=0
  if S[s] in lst:
    while s<=N-1 and S[s] in lst:
      s+=1
      tmp+=1
    ans=max(ans,tmp)
    if s==N:
      return ans
    else:
      return dp(s,ans)
  else:
    return dp(s+1,ans)
if N>=2: 
  print(dp(s,ans))
else:
  if S[0] in lst:
    print(1)
  else:
    print(0)

Submission status: Accepted

Solution code:
s=input()

cur=0
peek=0
length=0
for i in range(len(s)):
    if s[i] in ("A", "C", "G", "T"):
        peek=i
        l=(peek-cur)+1
        if length < l:
            length = l
    else:
        cur=i+1
        peek=i+1

print(length)

Submission status: Accepted

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

len_list = []
tmp = 0

for l in S:
    if l in ok:
        tmp += 1
    else:
        len_list.append(tmp)
        tmp = 0
    
len_list.append(tmp)
        
print(max(len_list))

Submission status: Accepted

Solution code:
S=input()
ans=0
cnt=0
for s in S:
    if s in ["A","C","G","T"]:
        cnt+=1
    else:
        if cnt > ans: ans=cnt
        cnt=0
#すべて一致する文字列の可能性あり
print(max(ans,cnt))

Submission status: Accepted

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

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:
from itertools import groupby
import re
S = input()
s = re.sub(r"[ATGC]", "0", S)
g = [len(list(v)) for k, v in groupby(s) if k=="0"]
if len(g)==0:
    print(0)
else:
    print(max(g))

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
#ABC122B
S = input()
SC= S.replace('C','A')
SCG = SC.replace('G','A')
SCGT = SCG.replace('T','A')
ans = 0
wk = 0
for i in range(int(len(S))):
    if SCGT[i:i+1] == 'A':
        wk += 1
    else:
        if wk >= ans:
            ans = wk
        wk =0

if wk >= ans:
    ans = wk
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
tmp = 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":
                  tmp += 1
                  if ans < tmp:
                           ans = tmp
         else:
                  tmp = 0
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

count = max_count = 0
for char in s:
    if char in ['A', 'T', 'G', 'C']:
        count += 1
    else:
        max_count = max(count, max_count)
        count = 0

print(max(max_count, count))

Submission status: Accepted

Solution code:
s=input()
t='ATGC'
ans=0
l=0
for x in s:
  if x in t:
    l+=1
    ans=max(ans,l)
  else:
    l=0
print(ans)

Submission status: Accepted

Solution code:
s = input()
acgt = 'ACGT'

max_len = 0
for i in range(len(s)):
    curr_len = 0
    for j in range(len(s) - i):
        if s[i + j] in acgt:
            curr_len += 1
        else:
            break
    if curr_len > max_len:
        max_len = curr_len
print(max_len)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from bisect import *
from collections import *
from copy import deepcopy
from datetime import *
from heapq import *
from itertools import *
from math import *
from operator import *
from pprint import *

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

def main():
    """ main """
    S = input().rstrip()
    N = len(S)
    idx = 0
    ans = 0
    tmp = 0
    while idx < N:
        if S[idx] in ['A','C','G','T']:
            tmp += 1
        else:
            ans = max(ans,tmp)
            tmp = 0
        idx += 1
    print(max(ans,tmp))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def slove():
    import sys
    import collections
    input = sys.stdin.readline
    s = str(input().rstrip('\n'))
    d = collections.defaultdict(list)
    d["A"]
    d["C"]
    d["G"]
    d["T"]
    mt = 0
    c = 0
    for i in range(len(s)):
        if s[i] in d:
            c += 1
        else:
            c = 0
        mt = max(mt, c)
    print(mt)


if __name__ == '__main__':
    slove()

Submission status: Accepted

Solution code:
def acgt(x):
  if x=="A" or x=="C" or x=="G" or x=="T":
    return True
  else:
    return False
txt=input()
ans=0
y=0
for i in range(len(txt)):
  if acgt(txt[i]):
    y+=1
  else:
    ans=max([ans,y])
    y=0
else:
  ans=max([ans,y])  
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())
s = 0
t = 0
c = {"A","C","G","T"}
for i in S:
    if i in c:
        s += 1
    else:
        s = 0
    if s > t:
        t = s
print(t)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = input()

counter = 0
max_count = 0

for str_i in range(len(s)):
  
  if s[str_i] in ['A', 'C', 'G', 'T']:
    counter += 1
  else:
    max_count = max(max_count, counter)
    counter = 0

max_count = max(max_count, counter)
print(max_count)

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline


def main():
    S = input()[:-1]

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()
X=["A","C","G","T"]
L=[0]
n=0
for i in range(len(S)) :
    if S[i] in X :
        L[n] += 1
    else:
        L.append(0)
        n += 1
print(max(L))

Submission status: Accepted

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

s = raw_input()
n = len(s)

cnt = 0;
maxCnt = 0;
for i in range(n):
    if s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T':
        cnt += 1
        maxCnt = max(maxCnt, cnt)
    else:
        cnt = 0

print maxCnt

Submission status: Accepted

Solution code:
L = list(input())

count = 0
m_count = 0
for i in L:
      if i == 'A' or i == 'C' or i == 'G' or i == 'T':
            count += 1
            if count >= m_count:
                  m_count = count
      else:
            count = 0

print(m_count)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
lst = ["A", "C", "G", "T"]
s = input()
res = 0
tmp = 0
for e in s:
    if e in lst:
        tmp += 1
    else:
        tmp = 0
    if tmp > res:
        res = tmp
print(res)

Submission status: Accepted

Solution code:
S = input()

max = 0
count = 0
for i in range(len(S)):
    if(S[i] != 'A' and S[i] != 'T' and S[i] != 'G' and S[i] != 'C'):
        if(count > max):
            max = count
        count = 0
    else:
        count += 1

if(count > max):
    max = count

print(max)

Submission status: Accepted

Solution code:
S=input()
mx=0
flag=1
for i in range(11):
    for j in range(11):
        if i>=j:
            continue
        for s in S[i:j]:
            if s not in ['A','G','C','T']:
                flag=0
        if flag:
            mx=max(len(S[i:j]),mx)
        else:
            flag=1

print(mx)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    import re
    pattern="[A,C,G,T]+"
    cmp=re.compile(pattern)
    S=input()
    res=cmp.findall(S)
    if res:
        print(max(len(s) for s in res))
    else:
        print(0)
resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())
cnt = 0
max_cnt = 0

for elem in S:
    if elem in ["A", "C", "G", "T"]:
        cnt += 1
        if cnt >= max_cnt:
            max_cnt = cnt
    else:
        cnt = 0

print(max_cnt)

Submission status: Accepted

Solution code:
s = str(input())
ans =0
cnt =0
#print(s[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
        if ans < cnt:
            ans = cnt
    else:
        cnt = 0
print(ans)

Submission status: Accepted

Solution code:
b=input()
a=[]
e=[]
for i in range(len(b)):
    for j in range(len(b)):
        c=b[i:j+1]
        if len(c) >0:
            a.append(c)

    
for j in a:     
    total=0
    for k in 'ACGT':
        d=j.count(k)
        total +=d
        if total == len(j):
            e.append(total)    

if e == []:
    print(0)
else:    
    print(max(e))

Submission status: Accepted

Solution code:
s = input()

ans = 0
# for i in range(n):
i = 0
while i <= len(s) - 1:
    index = i
    length = 0
    while i <= len(s) - 1:
        if s[i] in ["A", "C", "G", "T"]:
            length += 1
            i += 1
        else:
            # ans = [index, length]
            ans = max(ans, length)
            i += 1
            break


print(max(ans, length))

Submission status: Accepted

Solution code:
# B - ATCoder
S = str(input())
count = 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':
        count += 1
        if ans <= count:
            ans = count
        else:
            pass
    else:
        count = 0

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
l = len(s)
li = [0]
for i in range(l):
    for j in range(l-i):
        if all([k in ['A','C','G','T'] for k in list(s[i:i+j+1])]):
            li.append(len(s[i:i+j+1]))
print(max(li))

Submission status: Accepted

Solution code:
import re
print(max(map(len, re.findall("[ACGT]*",input()))))

Submission status: Accepted

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

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+1-i)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
s = input()
max_length = 0
tmp_length = 0
match_char = ["A", "C", "G", "T"]
for si in s:
    if si in match_char:
        tmp_length += 1
        max_length = max(max_length, tmp_length)
    else:
        tmp_length = 0
print(max_length)

Submission status: Accepted

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

if A:
    A.sort(key=lambda x: len(x), reverse=True)
    print(len(A[0]))
else:
    print(0)

Submission status: Accepted

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

Submission status: Accepted

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

string = 'ACGT'
ans = 0
tmp = 0


for i in s:
    if i in string:
        tmp += 1
        ans = max(ans, tmp)
    else:
        tmp = 0

print(ans)

Submission status: Accepted

Solution code:
ans = [0]
acgt = "ACGT"
for s in input():
  if s in acgt:
    ans[0] += 1
  else:
    ans.insert(0, 0)
print(max(ans))

Submission status: Accepted

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

Submission status: Accepted

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

for n in range(len(s)):
  if s[n] in l:
    nl[-1]+=1
  else:
    nl.append(0)

print(max(nl))

Submission status: Accepted

Solution code:
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    

S=input()
ans=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
		for j in range(1,len(S)-i):
			if S[i+j]=="A" or S[i+j]=="T" or S[i+j]=="C" or S[i+j]=="G":
				cnt+=1
			else:
				ans=max(cnt,ans)
				cnt=0
				break
			
	else:
		continue		
							
	ans=max(ans,cnt)
	cnt=0
			
ans=max(ans,cnt)

print(ans)

Submission status: Accepted

Solution code:
S = list(input())
ans = 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 ans < count:
            ans = count
        else:
            pass
        count = 0
if ans < count:
    ans = count
else:
    pass
print(ans)

Submission status: Accepted

Solution code:
S = input()

max_num = 0
continuous_num = 0

for s in S:
    if s == 'A' or s == 'C' or s == 'G' or s == 'T':
        continuous_num += 1
        if continuous_num > max_num:
            max_num = continuous_num
    else:
        continuous_num = 0

print(max_num)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

ans = 0
for i in range(len(s)+1):
    for j in range(len(s)+1):
        ss = s[i:j]
        acgt = ['A', 'C', 'G', 'T']
        fl = 1
        for si in ss:
            if si not in acgt:
                fl = 0
                break
        if fl == 1 and len(ss) > 0:
            ans = max(ans, j - i)

print(ans)

Submission status: Accepted

Solution code:
# ABC122 B - ATCoder
s = input()
n = len(s)

acgt = 'A','C','G','T'
ans = 0

for i in range(n):
    for j in range(n-i):
        S = s
        S = S[j:j+i+1]
        t = 0
        for k in range(len(S)):
            if S[k:k+1] not in acgt:
                break
            if k+1 == len(S):
                t = len(S)
                ans = max(ans,t)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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