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()
N = len(s)
ans = 0
for i in range(N):
    for j in range(i+1, N+1):
        ok = True
        for k in range(i, j):
            if s[k] not in 'ACGT':
                ok = False
        if ok:
            ans = max(ans, j - i)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
ans = 0
k=0
l='ACGT'
for s_ in s:
    if s_ in l:
        k+=1
    else:
        ans=max(k,ans)
        k=0
ans = max(k,ans)
print(ans)

Submission status: Accepted

Solution code:
ATGC = ["A", "T", "G", "C"]
s = input()
max_length = 0
tmp_length = 0
for car in s:
    if car in ATGC:
        tmp_length += 1
    else:
        max_length = max(max_length, tmp_length)
        tmp_length = 0

max_length = max(max_length, tmp_length)
print(max_length)

Submission status: Accepted

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

mx = 0
for i in range(n):
	for j in range(i,n):
		part = S[i:j+1]
		if all(c in char for c in part) and mx<len(part):
			mx = len(part)

print(mx)

Submission status: Accepted

Solution code:
s = list(input())

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

a = -1
b = -1

L = 0
R = -1
mode = 1
for i in range(len(s)):
    if mode == 0:
        if s[i] in base:
            b += 1
        else:
            mode = 1
            if b - a > R - L:
                L = a
                R = b
    elif mode == 1:
        if s[i] in base:
            a = i
            b = i
            mode = 0

if mode == 0 and b - a > R - L:
    L = a
    R = b

print(R - L + 1)

Submission status: Accepted

Solution code:
#abc122b

s=raw_input()
res=0
for i in xrange(len(s)):
 for j in xrange(i,len(s)):
  if all('ACGT'.count(c)==1 for c in s[i:j+1]):
   res=max(res,j-i+1)
print res

Submission status: Accepted

Solution code:
input = input()

max = 0
count = 0
result = []

for s in input:
	
	if s in ('A','T','C','G'):
		
		result.append(s)
		
		if max < len(result):
			max = len(result)
		
	else:
		result = []
		
print(max)

Submission status: Accepted

Solution code:
a = " "+input()
dp = [0]*11
for i ,n in enumerate(a[1:]):
    if n in ["A","T","C","G"]:
        dp[i]=dp[i-1]+1
    else:
        dp[i] = 0
print(max(dp))

Submission status: Accepted

Solution code:
S = input()
maxv = 0
tmp = 0
t = list("ATCG")
for i in range(len(S)):
    if S[i] in t:
        tmp += 1
        maxv = max(maxv, tmp)
    else:
        tmp = 0
print(maxv)

Submission status: Accepted

Solution code:
n = input()
m = 0
max_m = 0 
for s in n:
    if s in "ATCG":
        m += 1
    else:
        m = 0
    if m > max_m:
        max_m = m
print(max_m)

Submission status: Accepted

Solution code:
S = input()
l=0
max_l =0
for i in S:
  if i in 'ATCG':
    l+=1
  else:
    l=0
  if l> max_l:
    max_l = l
print(max_l)

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
length, max_length = 0, 0
s = input()

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

print(max_length)

Submission status: Accepted

Solution code:
s = raw_input()
best = 0
l = ['A','G','C','T']
cur = 0
for x in s:
  if x in l:
    cur += 1
    if cur > best:
      best = cur
  else:
    cur = 0
print best

Submission status: Accepted

Solution code:
def solve():
  S = input().strip()
  cur, mak = 0,0
  for x in S:
    cur = cur+1 if x in "ACGT" else 0
    mak = max(mak, cur)
  print(mak)


if __name__ == '__main__':
  solve()

Submission status: Accepted

Solution code:
s = input()
li = list(s)
max = 0
count = 0

for i in li:
    if i == 'A' or i == 'C' or i == 'G' or 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().strip()
enki = set('ATCG')
count = 0
maxlen = 0
for c in s:
    if c in enki:
        count += 1
    else:
        maxlen = max(maxlen, count)
        count = 0
maxlen = max(maxlen, count)
print(maxlen)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re
print(max(x.end()-x.start() for x in re.finditer('[ACGT]*',input())))

Submission status: Accepted

Solution code:
S = input()
i = None
ans = 0
for j in range(len(S)):
    if S[j] not in ("A", "C", "G", "T"):
        i = None
        continue
    if i is None:
        i = j
    ans = max(ans, j - i + 1)
print(ans)

Submission status: Accepted

Solution code:
S = input()

lenmax = 0
lenACGT = 0
for s in S:
    if(s in "ACGT"):
        lenACGT += 1
    else:
        lenACGT = 0
    if(lenmax < lenACGT):
        lenmax = lenACGT
#    print("s = {}, lenACGT = {}, lenmax = {}".format(s, lenACGT, lenmax))

print(str(lenmax))

Submission status: Accepted

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

def main():
    S = SI()
    arr = []
    tmp = 0
    for s in S:
        if s in 'ACGT':
            tmp += 1
        else:
            tmp = 0
        arr.append(tmp)
    ans = max(arr)

    return ans

print(main())

Submission status: Accepted

Solution code:
p=m=0
for c in input():p=-~p*(c in'ATGC');m=max(m,p)
print(m)

Submission status: Accepted

Solution code:
# ATCoder
# ACGTだけ
S = input()

def getAns(S) :
    cnt = 0
    rtn = 0
    for i in S :
        if i == "A" or i == "C" or i == "G" or i == "T" :
            cnt += 1
            rtn = max(cnt, rtn)
        else :
            cnt = 0
    return rtn

print(getAns(S))

Submission status: Accepted

Solution code:
import re
ptn = re.compile(r"(A|C|G|T)*")

S = input()

ans = 0
for i in range(len(S)):
  for j in range(len(S)):
    x = ptn.match(S[i:i+j+1]).group(0)
    if(x):
      ans = max(ans, len(x))
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
p=0
m=0
for c in input():
  p+=1
  if not c in"ATGC":p=0
  m=max(m,p)
print(m)

Submission status: Accepted

Solution code:
S = input()
replaced = ""
for s in S:
  if s in "ACGT":
    replaced += "1"
  else:
    replaced += "0"
    
print(max([len(r) for r in replaced.split("0")]))

Submission status: Accepted

Solution code:
S = input()

l_max, l = -1, 0

for c in S:
    if c in ['A', 'C', 'G', 'T']:
        l += 1
    else:
        l_max = l if l > l_max else l_max
        l = 0

print(max(l, l_max))

Submission status: Accepted

Solution code:
s = input()
N = len(s)
ans = 0
for left in range(N):
    for right in range(left + 1, N + 1):
        # [left, right)
        if all(c in 'ACGT' for c in s[left:right]):
            ans = max(ans, right - left)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
  V = input()
  
  #print(V)
  
  flg = 0
  max_v = 0
  for i in V:
    #print(i)
    if i == 'A' or i=='T' or i=='G' or i=='C':
      flg += 1
      max_v = max(max_v, flg)
    else:
      flg = 0
      
  print(max_v)

Submission status: Accepted

Solution code:
s=list(input())
n=len(s)
T="ACGT"
cnt=[0]*20
total=[0]*20
for i in range(n):
    if s[i] in T:
        cnt[i]=1
for i in range(1,n+1):
    if cnt[i-1]==1:
        total[i]=total[i-1]+1
    else:
        total[i]=0
print(max(total))

Submission status: Accepted

Solution code:
import re;print(max(map(len,re.findall('[ATGC]*',input()))))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
ATGC= ("A", "T", "G", "C")
ans, test = 0, 0

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

Submission status: Accepted

Solution code:
import re
print(max(len(s) for s in re.split(r'[^ATGC]+', input())))

Submission status: Accepted

Solution code:
S = str(input())
ans = 0
for i in range(len(S)):
    for j in range(i+1, len(S)+1):
        tmp = S[i:j]
        flag = True
        for char in tmp:
            if char in set(['A', 'G', 'C', 'T']):
                continue
            else:
                flag = False
                break
        if flag:
            ans = max(ans, len(tmp))
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

cnt = 0
a = []
for i in range(len(S)):
    if S[i] == 'A' or S[i] == 'T' or S[i] == 'G' or S[i] == 'C':
        cnt += 1
        if i == len(S) - 1:
            a.append(cnt)
    else:
        lenflag = False
        a.append(cnt)
        cnt = 0
print(max(a))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
current = 0
ret = 0
for x in S:
    if x in 'ACGT':
        current += 1
        ret = max(ret, current)        
    else:
        current = 0
print(ret)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline
s = input()
acgt = ['A', 'C', 'G', 'T']
cnt, tmp = 0, 0
for c in s:
    if c in acgt:
        tmp += 1
    else:
        cnt = max(cnt, tmp)
        tmp = 0
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
S = input()
ans = 0
for l in range(len(S)):
    for r in range(1, len(S) + 1):
        if l < r and all(S[k] in list('ACGT') for k in range(l, r)):
            ans = max(ans, r - l)
print(ans)

Submission status: Accepted

Solution code:
S = input()
ret = 0
for x in range(len(S)):
    for y in range(x + 1, len(S) + 1):
        s = S[x:y]
        if all([x in 'ACGT' for x in s]):
            ret = max(ret, len(s))
print(ret)

Submission status: Accepted

Solution code:
S = input()
n = len(S)
ans = 0
for i in range(n):
    for j in range(i, n):
        # ↓文字cがACGTでない。ACGT文字列でない。
        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()
n = len(S)
ans = 0
for i in range(n):
    for j in range(i, n):
        # ↓文字cがACGTでない。ACGT文字列でない。
        if not any('ACGT'.count(c) == 0 for c in S[i:j + 1]):
            ans = max(ans, j - i + 1)
print(ans)

Submission status: Accepted

Solution code:
from sys import stdin

s = list(stdin.readline().rstrip())
acgt = ['A', 'C', 'G', 'T']

ans = 0
tmp = 0

for i in s:
    if i in acgt:
        tmp += 1
    else:
        if ans <= tmp:
            ans = tmp
        tmp = 0

if ans <= tmp:
    ans = tmp

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
p = 'ACGT'
s = input()
l = len(s)
r = 0
i = -1
while i < l:
 j = next((i for i in range(i + 1, l) if s[i] in p), l)
 i = next((i for i in range(j + 1, l) if s[i] not in p), l)
 r = max(r, i - j)
print(r)

Submission status: Accepted

Solution code:
S = input()
arr = ['A', 'C', 'G', 'T']
 
cnt = 0
maxCnt = 0
for s in S:
  if s in arr:
    cnt += 1
  else:
    if maxCnt < cnt:
      maxCnt = cnt
    cnt = 0
if maxCnt < cnt:
  maxCnt = cnt
print(maxCnt)

Submission status: Accepted

Solution code:
def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

s = input()
lis = ["A", "T", "G", "C"]
cnt = 0
maxcnt = 0
for i in range(len(s)):
    if(my_index(lis, s[i], -1)>=0): 
        cnt += 1
        #print(my_index(lis, s[i]), s[i], my_index(lis, s[i])>=0)
    else:
        maxcnt = max(maxcnt, cnt)
        cnt = 0
maxcnt = max(maxcnt, cnt)
print(maxcnt)

Submission status: Accepted

Solution code:
import re;print(max(len(s)for s in re.findall('[ATGC]*',input())))

Submission status: Accepted

Solution code:
s=input()
n=len(s)
ans=0
for i in range(n):
  for j in range(i,n):
    #特定区間の配列要素の1つずつについて、所定の文字列にその1要素があるか。
    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())
an = ["-" for i in range(len(s))]
ans = 0
ch = ["A","G","T","C"]
for i in range(len(s)):
    if s[i] in ch:
        an[i] = "1"
    else:
        an[i] = "0"
for i in range(len(s)):
    for j in range(i+1,len(s)+1):
        if an[i:j] == ['1' for i in range(len(an[i:j]))]:
            ans = max(ans,len(an[i:j]))
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
tmp = input()

out_1 = 0
tmp_s = []
for c in tmp:
        if c == "A" or c == "G" or c == "T" or c == "C":
                tmp_s.append(c)
        else:
                if out_1 < len(tmp_s):
                        out_1 = len(tmp_s)
                tmp_s = []
if out_1 < len(tmp_s):
        out_1 = len(tmp_s)
print(out_1)

Submission status: Accepted

Solution code:
import re

S = input()
lmax = 0

for i in range(len(S)):
    for j in range(i, len(S)):
        ss = S[i:j+1]
        l = re.findall(r'[^ACGT]', ss)
        if len(l) == 0:
            lmax = max(lmax, len(ss))
        else:
            continue
print(lmax)

Submission status: Accepted

Solution code:
S = input()
lis_S = list(S)
Ans = []
index = 0
n = 0
for char in lis_S:
    Ans.append(0)
    if char=="A" or char=="C" or char=="G" or char=="T":
        Ans[n] += 1
        index += 1
    elif index < len(lis_S):
        index += 1
        n += 1
        continue
    else:
        break
print(max(Ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

lst = []
for i in range(0, len(S)):
    for k in range(0, len(S)):
        if i > k:
            pass
        else:
            lst.append(S[i:k+1])
lst.append("")
lst_AGCT = []
for i in range(len(lst)):
    if "B" in lst[i] or "D" in lst[i] or "E" in lst[i] or "F" in lst[i] or "H" in lst[i] or "I" in lst[i] or "J" in lst[i] or "K" in lst[i] or "L" in lst[i] or "M" in lst[i] or "N" in lst[i] or "O" in lst[i] or "P" in lst[i] or "Q" in lst[i] or "R" in lst[i] or "S" in lst[i] or "U" in lst[i] or "V" in lst[i] or "W" in lst[i] or "X" in lst[i] or "Y" in lst[i] or "Z" in lst[i]:
        pass
    else:
        lst_AGCT.append(lst[i])

if lst_AGCT == [""]:
    print(0)
else:
    print(len(max(lst_AGCT, key=len)))

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):
        if all(c in 'ATCG' for c in s[i:j]):
            ans = max(ans, j - i)

print(ans)

Submission status: Accepted

Solution code:
s=list(input())+['Z']
ACGT=['A','C','G','T']
t=[]
count=0
for i in s:
    if i in ACGT:
        count+=1
    else:
        t.append(count)
        count=0

if len(t)==0:
    print(len(s))
else:
    print(max(t))

Submission status: Accepted

Solution code:
inp = input()
count = 0
ans = 0
for n in inp:
    if(n == 'A' or n == 'T' or n == 'C' or n == 'G'):
        count += 1
        if(count > ans):
            ans = count
    else:
        count = 0
print(ans)

Submission status: Accepted

Solution code:
b = input()
templist = [0,0,0,0,0,0,0,0,0,0,0,0,0,0]
temp = 0
index = 0
for i in b:
    if i == "A" or i == "C" or i == "G" or i == "T":
        temp = temp + 1
        templist[index] = 1 + templist[index]
    else:
        temp = 0  
        index = index + 1

print(max(templist))

Submission status: Accepted

Solution code:
def AGCT(x):
    if x=='A':
        return True
    elif x=='G':
         return True
    elif x =='C':
        return True 
    elif x=='T':
        return True
    else:
        return False

S = list(input())
Ans = [0]
flag = 0
i_new =0
ans = 0
for i in range(len(S)):
    ans = 0
    flag = 0
    if AGCT(S[i])==True:
        ans += 1
        i_new = i
        while flag ==0:
            i_new += 1
            if i_new >len(S)-1:
                Ans.append(ans)
                flag = 1
            elif AGCT(S[i_new])!=True:
                Ans.append(ans)
                flag = 1
            else:ans += 1

print(max(Ans))

Submission status: Accepted

Solution code:
S = input()
list = ['A', 'C', 'G', 'T']
answer = 0
current = 0
for i in range(len(S)):
    if S[i] not in list:
        if answer < current:
            answer = current
        current = 0
    elif S[i] in list:
        current += 1
if answer < current:
    answer = current
print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
m = 0
c = 0
for s in input().strip():
    if s in "AGCT":
        c += 1
        if c > m:
            m = c
    else:
        c = 0
print(m)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re
S = str(input())
ans = 0
for i in re.findall('[ACGT]*', S):
    if ans < len(i):
        ans = len(i)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

def findLength(index):
    length = 0
    for c in s[index:]:
        if c in arr:
            length +=1
        else:
            break
    return length

max_length = 0
for i in range(0, len(s)):
    L = findLength(i)
    max_length = max(max_length, L)
    

print(max_length)

Submission status: Accepted

Solution code:
#coding: utf-8
S = input()
enki = ["A", "T", "G", "C"]
a = []
ans = ""
max_ = 0
for i in range(len(S)):
    if S[i] in enki:
        ans += S[i]
    else:
        ans = ""
    a.append(ans)
    max_ = max(max_, len(ans))
print(max_)

Submission status: Accepted

Solution code:
s=list(input())
count=[0]*5
j=0
for i in s:
  if(i=="A" or i=="T" or i=="C" or i=="G"):
    count[j]=count[j]+1
  else:
    j=j+1
print(max(count))

Submission status: Accepted

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

S = input()
lst = [c for c in S]

le = len(lst)

for i in range(0,le):
    if lst[i] == "A" or lst[i] == "C" or lst[i] == "G" or lst[i] == "T":
        lst[i] = 1
    else:
        lst[i] = 0

ans = 0
ans_sub = 0
for i in range(0,le):
    if lst[i] == 1:
        ans_sub += 1
        if ans_sub >= ans:
            ans = ans_sub
    else:
        if ans_sub >= ans:
            ans = ans_sub
        ans_sub = 0

        

print(ans)

Submission status: Accepted

Solution code:
row = input()
lenght = len(row)
max_moji = 0
for i in range(lenght):
    if row[i] in 'ACGT':
        moji = 1
        for j in range(i + 1, lenght):
            if row[j] in 'ACGT':
                moji += 1
            else:
                break
        max_moji = moji if moji > max_moji else max_moji
    if max_moji == lenght - i:
        break
print(max_moji)

Submission status: Accepted

Solution code:
a = input()
a=a.replace("T","A")
a=a.replace("C","A")
a=a.replace("G","A")

for i in range(len(a)+1):
  if  "A"*i in a:
    max=i
print(max)

Submission status: Accepted

Solution code:
s = input().rstrip()
max_cnt=0
cnt=0
for al in s:
	if al not in "ACGT":
		cnt = 0
	else:
		cnt += 1
		max_cnt = max(max_cnt,cnt)

max_cnt = max(max_cnt,cnt)
print(max_cnt)

Submission status: Accepted

Solution code:
s = input()
answer = 0
for x in range(len(s)):
    for y in range(x + 1, len(s) + 1):
        t = s[x:y]
        if all(c in 'ACGT' for c in t):
            answer = max(answer, len(t))

print(answer)

Submission status: Accepted

Solution code:
import re

data = input()

t = re.split('[^ACGT]+', data)
t.sort(key=len, reverse=True)
print(len(t[0]))

Submission status: Accepted

Solution code:
import re
print(max(list(map(len, re.compile(r'[A|G|C|T]*').findall(input())))))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

ns = [0]
n = 0

for s in S:
    if s in 'ACGT':
        n += 1
    else:
        ns.append(n)
        n = 0
ns.append(n)

print(max(ns))

Submission status: Accepted

Solution code:
import re
S = input()
L = len(S)
mlen = 0

match = re.findall('[ATGC]+', S)
#print(match.span())
for m in match:
    if len(m) > mlen:
        mlen = len(m)
print(mlen)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)


def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(S):
    ans = 0
    tmp = 0
    targ = 'ACGT'
    for c in S:
        if c in targ:
            tmp += 1
        else:
            ans = max(ans, tmp)
            tmp = 0
    ans = max(ans, tmp)
    return ans


def main():
    S = read_str()
    print(slv(S))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()

AGCT = {"A", "G", "C", "T"}

j = 0
l = 0
l_log = []

while j < len(S):
    if S[j] in AGCT:
        l += 1
        if j == len(S) - 1:
            l_log.append(l)
    else:
        l_log.append(l)
        l = 0
    j += 1

print(max(l_log))

Submission status: Accepted

Solution code:
S = input()
sum = 0
maxsum = 0
for i in range(len(S)):
    if S[i] in "ACGT":
        sum +=1
    else:
        if maxsum < sum:
            maxsum = sum
        sum = 0
if maxsum < sum:
    maxsum = sum
print(maxsum)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = "ACGT"
c = 0
m = 0
s = input()

for x in s:
    if x in a:
        c += 1
        if c > m:
            m = c
    else:
        c = 0

print(m)

Submission status: Accepted

Solution code:
import sys
import numpy as np
sys.setrecursionlimit(20000000)
input = sys.stdin.readline
s = input()
ans = 0
tmp = 0
for i in range(len(s)):
        if s[i] in ["A","T","C","G"]:
                tmp += 1
        else:
                ans = max(ans,tmp)
                tmp = 0
ans = max(ans,tmp)
print(ans)

Submission status: Accepted

Solution code:
N = input()
charlist = list(N)
hoge = 0
maxscore = 0
def onon(char, hogehoge):
    nowscore = 0
    while char[hogehoge] == "A" or char[hogehoge] == "T" or char[hogehoge] == "G" or char[hogehoge] == "C" :
        hogehoge = hogehoge + 1
        nowscore += 1
        if hogehoge  >= len(char):
            break
    return nowscore 
for i in charlist:
    score = 0
    if i == "A" or i == "T" or i == "G" or i == "C"  :
        score = onon(charlist,hoge)
    if maxscore <= score:
        maxscore = score
    hoge = hoge + 1
print(maxscore)

Submission status: Accepted

Solution code:
def checkACGT(s):
    for i in range(len(s)):
        if s[i] == "A" or s[i] == "G" or s[i] == "C" or s[i] == "T":
            continue
        else:
            return False
    return True
  
s=input()
n = len(s)
check = []
check.append(s)
while True:
    if not check:
        print(0)
        break
    if checkACGT(check[0]):
        print(len(check[0]))
        break
    else:
        if len(check[0]) == 1:
            check.pop(0)
            continue
        check.append(check[0][1:])
        check.append(check[0][:len(check[0])-1])
        check.pop(0)

Submission status: Accepted

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

length = 0
for target in s:
	if target in acgt:
		length += 1
		if max_length < length:
			max_length = length
	else:
		length = 0

print(max_length)

Submission status: Accepted

Solution code:
s = input()
ml = 0
nc = 0
for c in s:
    if c in "ACGT": 
        nc += 1
    else:
        ml = max(ml, nc)
        nc = 0
ml = max(ml, nc)
print(ml)

Submission status: Accepted

Solution code:
S = input()

maxLen = 0
maxCnt = 0
lstString = ["A" ,"T" ,"C" ,"G"]
for i in range(len(S)):
  if S[i] in lstString:
    maxCnt = 0
    for j in range(i, len(S)):
      if S[j] in lstString:
        maxCnt += 1
      else:
        # print("ok")
        break
    maxLen = max(maxLen, maxCnt)


print(maxLen)

Submission status: Accepted

Solution code:
s = input()
c = False
for l in range(10):
    l = 10 - l
    sl = [s[i:i+l] for i in range(len(s)-l+1)]
    for w in sl:
        if set(w).issubset(set("AGCT")):
            c = True
            print(l)
            break
    else:
        continue
    break
if not c:
    print(0)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 24 20:27:19 2019

@author: screamLab
"""

s = input()
s += 'H'
atcg = ['A','T','C','G']
ans = 0
long = 0
for i in range(len(s)):
    if s[i] in atcg:
        if i == len(s):
            break
        if s[i+1] in atcg:
            ans += 1
        else:
            ans += 1
            long = max(long,ans)
            ans = 0
long = max(long,ans)
print(long)

Submission status: Accepted

Solution code:
S = input()
list_atgc = ["A", "C", "G", "T"]
demand_list = []
for i in range(len(S)):
    if S[i] in list_atgc:
        j = 0
        string_k = ""
        while True:
            if S[i+j] in list_atgc:
                string_k += S[i+j]
                demand_list.append(string_k)
                j += 1
                if i + j >= len(S):
                    break
            else:
                break
if demand_list:
    print(len(max(demand_list, key=len)))
else:
    print(0)

Submission status: Accepted

Solution code:
s = input()

result = []
result_1 = ["A","C","G","T"]
end = False
sum = 0

for i in range(len(s)):
    temporary = i
    sum = 0
    while True:
        if end == True:
            break
        for x in result_1:
            try:
                if s[temporary] == x:
                    sum += 1
                    temporary += 1
                    break
            except:
                end = True
        else:
            result.append(sum)
            break

print(max(result))