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()
chars = ''
ans = 0
acgt = ['A', 'C', 'G', 'T']
for char in S:
  if char in acgt:
    chars+=char
  else:
    chars = ''
  ans = max(ans, len(chars))
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 16 20:52:46 2019

@author: Owner
"""


import collections
import scipy.misc
import sys
import numpy as np
import math
from operator import itemgetter
import itertools
import copy
import bisect

#素因数を並べる
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(int(n))
  return table   
# 桁数を吐く
def digit(i):
    if i > 0:
        return digit(i//10) + [i%10]
    else:
        return []
    
def getNearestValueIndex(list, num):
    """
    概要: リストからある値に最も近い値のインデックスを取得する関数
    @param list: データ配列
    @param num: 対象値
    @return 対象値に最も近い値
    """

    # リスト要素と対象値の差分を計算し最小値のインデックスを取得
    idx = np.abs(np.asarray(list) - num).argmin()
    return idx

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


"""
N, X = map(int, input().split())

x = [0]*N
x[:] = map(int, input().split())

P = [0]*N
Y = [0]*N
for n in range(N):
    P[n], Y[n] = map(int, input().split())

    
all(nstr.count(c) for c in '753')

# 複数配列を並び替え
ABT = zip(A, B, totAB)
result = 0
# itemgetterには何番目の配列をキーにしたいか渡します
sorted(ABT,key=itemgetter(2))
A, B, totAB = zip(*ABT)
A.sort(reverse=True)

# 2進数のbit判定
(x >> i) & 1

# dp最小化問題
dp = [np.inf]*N
for n in range(N):
    if n == 0:
        dp[n] = 0
    else:
        for k in range(1,K+1):
            if n-k >= 0:
                dp[n] = min(dp[n], dp[n-k] + abs(h[n]-h[n-k]))
            else:
                break

"""
S = input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
iL = len(S)
iC = 0
iT = 0
bS = False
for i in range(iL):
    if S[i] in ['A','C','G','T'] :
        if bS:
            iT += 1
        else:
            bS = True
            iT = 1
        if iT > iC:
            iC = iT
    else:
        bS = False
        iT = 0
print(iC)

Submission status: Accepted

Solution code:
b = input()
l = ["A","T","G","C"]
counting = 0
tmp=0
for bb in b:
    if bb in l:
        tmp+=1
    else:
        if counting<tmp:
            counting=tmp
        tmp=0
if counting<tmp:
    counting=tmp
print(counting)

Submission status: Accepted

Solution code:
S = input()

cnt = 0
max = 0

for i in S:
  if i == "A" or i == "C" or i == "G" or i == "T" :
    cnt += 1
    if max < cnt :
      max = cnt
  else :
    cnt = 0
print(max)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

c = 0
m = 0
for s in S:
    if s in 'ACGT':
        c += 1
        if m < c:
            m = c
    else:
        c = 0
print(m)

Submission status: Accepted

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

ans,count,flag = 0,0,1
for s in S:
    if s in L:
        if not flag:
            flag = 1
            count = 0
        count += 1
    else:
        if flag:
            flag = 0
            ans = max(ans,count)
ans = max(ans,count)

print(ans)

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

tmp = 0
ans = 0
s = 'ACTG'


for c in S:
    if c in s:
        tmp += 1
        if tmp > ans:
            ans = tmp
    else:
        tmp = 0

print(ans)

Submission status: Accepted

Solution code:
def main():
    S = input()

    n = len(S)
    ans = 0
    for i in range(n):
        for j in range(i, n):
            x = S[i:j+1]
            tmp = len(x)
            for c in x:
                if c not in "ACGT":
                    tmp = -1
                    break
            ans = max(ans, tmp)

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

def is_atgc(T):
  for t in T:
    if t in ['A', 'T', 'G', 'C']:
      continue
    else:
      return False
  return True

max_ = 0
max_S = ''
for i in range(len(S)):
  for j in range(i+1, len(S)+1):
    SS = S[i:j]
    if is_atgc(SS):
      if len(SS) > max_:
        max_S = SS
        max_ = len(SS)
print(max_)

Submission status: Accepted

Solution code:
def is_acgt(s: str)->int:
    AGCT = 'AGCT'
    for c in s:
        if c not in AGCT:
            return False
    return True


def atcoder(S: str)->int:
    n = len(S)
    max_len = 0
    for i in range(n):
        for j in range(i, n):
            if is_acgt(S[i:j+1]):
                max_len = max(max_len, j - i + 1)
    return max_len


if __name__ == "__main__":
    S = input()
    ans = atcoder(S)
    print(ans)

Submission status: Accepted

Solution code:
char = input()
char_list = list(char)

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

Submission status: Accepted

Solution code:
s = input()

cnt = 0
max_cnt = 0
for elem in s:
    if elem == 'A' or elem == 'C' or elem == 'G' or elem == 'T':
        cnt += 1
    else:
        if max_cnt < cnt:
            max_cnt = cnt
        cnt = 0
if max_cnt < cnt:
    max_cnt = cnt
print(max_cnt)

Submission status: Accepted

Solution code:
b = input()
_l = ["A", "T", "C", "G"]
max_l = 0
cur_l = 0
for s in b:
    if s in _l:
        cur_l += 1
    else:
        max_l = max(max_l, cur_l)
        cur_l = 0
        
max_l = max(max_l, cur_l)
print(max_l)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re

def solve():
  S = input()
  parts = re.split(r'[^ACGT]', S)
  return max(list(map(lambda s: len(s), parts)))

print(solve())

Submission status: Accepted

Solution code:
S = input()

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

    if (ans < cnt): ans = cnt

print(ans)

Submission status: Accepted

Solution code:
s = input()

length = 0
max_len = 0

for ch in s:
    if ch in "ATCG":
        length += 1
    else:
        max_len = max(max_len, length)
        length = 0

max_len = max(max_len, length)
print(max_len)

Submission status: Accepted

Solution code:
def main():
    count_max = 0
    count = 0
    s = input()
    for c in s:
        if c in "ATGC":
            count += 1
        else:
            count_max = max(count, count_max)
            count = 0

    count_max = max(count, count_max)

    print(count_max)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s=input()

r=0
b=0
for z in s:
  if z=="A" or z=="C" or z=="G" or z=="T":
    b+=1
  else:
    if r<b:
      r=b
    b=0

if r<b:
  r=b

print(r)

Submission status: Accepted

Solution code:
S = input()
N = len(S)

ans = 0
before = 0
for i in range(N):
    tmp = S[i]
    if tmp == 'A' or tmp == 'T' or tmp=='C' or tmp == 'G':
        pass
    else:
        ans = max(i - before, ans)
        before = i + 1

ans = max(N - before, ans)
print(ans)

Submission status: Accepted

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

print(mx)

Submission status: Accepted

Solution code:
s = input()
res = 0
for i in range(0,10):
    for j in range(i+1,11):
        for x in s[i:j]:
            if x not in ['A','C','G','T']:
                break
        else:
            if res < len(s[i:j]):
                res = len(s[i:j])
print(res)

Submission status: Accepted

Solution code:
x = input()
a = {"A", "T", "G", "C"}
now = 0
M = 0
for c in x:
    if c in a:
        now += 1
    else:
        if now > M:
            M = now
        now = 0
if now > M:
    M = now
print(M)

Submission status: Accepted

Solution code:
import sys

l = raw_input().split()
S = l[0]

l = len(S)

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

def acgt_len(S):
    l = 0
    for s in S:
        if s not in acgt:
            return l
        l += 1
    return l

max_len = 0
for i in range(l):
    for j in range(l - i):
        l = acgt_len(S[j:])
        max_len = max(max_len, l)

print(max_len)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
S = input()
ans = 0
count = 0
for s in S:
    if s in ("A","C","G","T"):
        count+=1
    else:
        count=0
    if ans<count:
        ans=count
print(ans)

Submission status: Accepted

Solution code:
s = input()

def check(s):
    if s=="A" or s=="C" or s=="G" or s=="T":
        return True
    else:
        return False

max_count = 0
for i in range(len(s)):
    count = 0
    for j in range(i,len(s)):
        if check(s[j]):
            count+=1
        else:
            break
    max_count = max(count,max_count)

print(max_count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
max = 0
for i in range(len(S)):
    if(S[i] not in ['A', 'T', 'C', 'G']):
        continue
    for n in range(i, len(S)):
        if(S[n] in ['A', 'T', 'C', 'G']):
            if(max < n - i + 1):
                max = n - i + 1
        else:
            break
print(max)

Submission status: Accepted

Solution code:
S = input()
ans = 0
for i in range(len(S)):
  for j in range(len(S)):
    tmp = S[i:j+1]
    for k in tmp:
      if k != 'A' and k != 'C' and k != 'G' and k != 'T':
        break
    else:
      if ans <= len(tmp):
        ans = len(tmp)
print(ans)

Submission status: Accepted

Solution code:
S = str(input())

ans = []
for i in range(len(S)):
    for j in range(len(S)+1):
        if S[i:j].count('A') + S[i:j].count('C') + S[i:j].count('G') +S[i:j].count('T') == len(S[i:j]):
            ans.append((len(S[i:j]),S[i:j]))
print(sorted(ans, reverse=True)[0][0])

Submission status: Accepted

Solution code:
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18

S=input()

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

Submission status: Accepted

Solution code:
s=input()
k = 0
m = 0
for z in s:
  if z in "ACGT":
    k += 1
    if m < k:
      m = k
  else:
    k = 0
print(m)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
ans = 0
for l in range(len(s)):
    for r in range(l, len(s) + 1):
        t = s[l:r]
        if all(c in 'ACGT' for c in t):
            ans = max(ans, len(t))
print(ans)

Submission status: Accepted

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

@author: Yamazaki Kenichi
"""

S = input()

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

Submission status: Accepted

Solution code:
S = input()

maxcnt = 0
cnt = 0
for b in S:
  if (b == "A") or (b == "C") or (b == "G") or (b == "T"):
    cnt += 1
  else:
    cnt = 0
  if cnt > maxcnt:
    maxcnt = cnt

print(maxcnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re
S = input()
x = re.split("[^ATGC]", S)
print(max([len(i) for i in x]))

Submission status: Accepted

Solution code:
S=input()
l=[0 for _ in range(len(S))]
chars=['A','T','G','C']
tmp=0

for i in range(len(S)):
  if S[i] in chars:
    tmp+=1
  else:
    tmp=0
  l[i]=tmp

print(max(l))

Submission status: Accepted

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

Submission status: Accepted

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

output = 0
count = 0
for i in range(len(s)):
	if s[i] in check:
		count += 1
		if i == len(s)-1:
			output = max(output, count)
	else:
		output = max(output, count)
		count = 0

print(output)

Submission status: Accepted

Solution code:
S=input()

count=0
res=0
li=["A","T","G","C"]
for i in S:
    if(i in li):
        count+=1
    else:
        res=max(res,count)
        count=0
res=max(res,count)

print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()


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

print(cnt)

Submission status: Accepted

Solution code:
S = input()
ans = ""
temp = ""
for c in S:
    if c == "A" or c == "C" or c == "G" or c == "T":
        temp += c
        if len(ans) < len(temp):
            ans = temp
    else:
        temp = ""
print(len(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

max_len = 0
tmp = 0
for s in S:
    if s in "ACGT":
        tmp = tmp + 1
    elif max_len < tmp:
        max_len = tmp
        tmp = 0
    else:
        tmp = 0
if max_len < tmp:
    max_len = tmp

print(max_len)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

def main():
  s = input()
  maxi = 0
  _maxi = 0
  for x in s:
    if x in ['A', 'T', 'G', 'C']:
      _maxi += 1
    else:
      if maxi < _maxi:
        maxi = _maxi
      _maxi = 0
  if maxi < _maxi:
    maxi = _maxi
  print(maxi)


if __name__=='__main__':
  main()

Submission status: Accepted

Solution code:
import re
s = input()
a = re.split(r'[^ATGC]', s)
mx = max(map(len, a))
print(mx)

Submission status: Accepted

Solution code:
S = input()
N = len(S)
X = set(['A', 'G', 'C', 'T'])

ans = 0
for i in range(N + 1):
    for j in range(i, N + 1):
        substr = S[i:j]
        if X.issuperset(set(list(substr))):
            ans = max(ans, j - i)

print(ans)

Submission status: Accepted

Solution code:
S = input()
contain = ["A", "C", "G", "T"]
index = 0
size = 0
maxlen = 0
while index < len(S):
    if S[index] in contain:
        size += 1
    else:
        if size > maxlen:
            maxlen = size
        size = 0
    index += 1
if size > maxlen:
    maxlen = size
print(str(maxlen))

Submission status: Accepted

Solution code:
s=input()
d="ATGC"
m=0;r=""
for i in range(len(s)):
    for j in range(i,len(s)):
        if s[j] not in d:break
        else:
            if j-i+1>m:m=j-i+1;r=s[i:j+1]
print(m)

Submission status: Accepted

Solution code:
S = input()
ACGT = 'ACGT'
ans = 0
for i in range(len(S)):
    l = 0
    for j in range(i, len(S)):
        if S[j] in ACGT:
            l += 1
        else:
            break
    ans = max(ans, l)
print(ans)

Submission status: Accepted

Solution code:
S = input()
a = []
ls = ['A', 'C', 'G', 'T']
num = 0
for x in S:
    if x in ls:
        num += 1
        a.append(num)
    else:
        if num > 0:
            num = 0
if len(a) == 0:
    print(0)
else:
    print(max(a))

Submission status: Accepted

Solution code:
S = input()

ans = 0
cnt = 0
for i in S:
    if i in "ACGT":
        cnt += 1
    else:
        cnt = 0

    if ans < cnt:
        ans = cnt

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from collections import deque
def inpl(): return list(map(int, input().split()))

S = input()
A = set("ATCG")
ans = 0
mode = 0
for i, s in enumerate(S):
    if s in A:
        if mode == 0:
            mode = 1
            start = i
    else:
        if mode == 1:
            ans = max(i - start, ans)
            mode = 0
if mode == 1:
    ans = max(len(S) - start, ans)
print(ans)

Submission status: Accepted

Solution code:
import re
S  = input()


m = re.findall('[ATCG]+', S)

i = 0

for x in m:
    if i < len(x):
        i = len(x)

print(i)

Submission status: Accepted

Solution code:
s = list(input())

flag = False
k = 0
_t = 0

for s_i in s:
    if s_i == "A" or s_i == "T" or s_i == "G" or s_i == "C":
        flag = True
        _t += 1
    else:
        if flag:
            _t = 0
            flag = False
    if _t > k:
        k = _t

print(k)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = str(input())

l = len(s)
count=0
best=0
i=0
while i<l:
    while s[i]== "A" or s[i]== "G" or s[i]== "T" or s[i]== "C":
        count+=1
        i+=1
        if i==l:
            break
    if count>best:
        best = count
    count=0
    i+=1
if count > best:
    best=count
print(best)

Submission status: Accepted

Solution code:
S = input()
ans = 0
for i in range(len(S) + 1):
    for j in range(len(S), i, -1):
        s = S[i:j]
        for c in 'BDEFHIJKLMNOPQRSUVWXYZ':
            if c in s:
                break
        else:
            ans = max(ans, len(s))
print(ans)

Submission status: Accepted

Solution code:
import sys,collections,math;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

b = S()
t = ""
lis = []
for e in b:
    if e in "ATGC":
        t += e
    else:
        lis.append(t)
        t = ""
if e in "ATGC":
    lis.append(t)
ans = 0
for e in lis:
    ans = max(ans,len(e))
print(ans)

Submission status: Accepted

Solution code:
s = input()

answer = 0
l = 0
for c in s:
    if c in ['A', 'C', 'G', 'T']:
        l += 1
    else:
        l = 0
    if l > answer:
        answer = l
print(answer)

Submission status: Accepted

Solution code:
s=input()

le=0

i=0
while(i<len(s)):
    l=0
    while(i<len(s) and (s[i]=='A' or s[i]=='C' or s[i]=='G' or s[i]=='T')):
        l+=1
        i+=1

    if(l>le):
        le=l
    l=0
    i+=1
print(le)

Submission status: Accepted

Solution code:
s = input()
target = ['A','C','G','T']
ans = []
count = 0
for x in s:
    if target.count(x)>0:
        count += 1
    else:
        if count >0:
            ans.append(count)
            count = 0
print(max(ans+[count]))

Submission status: Accepted

Solution code:
S = input()

t = 0
ma = 0
for i in S:
  if i == "A" or i == "C" or i == "G" or i == "T":
    t += 1
  else:
    t = 0
  ma = max(ma, t)

print(ma)

Submission status: Accepted

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


import sys
import math

# 1整数
n = input()

ret = 0

atgc = ['A', 'T', 'G', 'C']
rr = 0
for c in n:
    if c in atgc:
        rr += 1
    else:
        ret = max(ret, rr)
        rr = 0
ret = max(ret, rr)
print(ret)

Submission status: Accepted

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

S = input()

S = S.replace("A", "-")
S = S.replace("C", "-")
S = S.replace("G", "-")
S = S.replace("T", "-")

for i in range(11):
    if not "".join(["-"] * i) in S:
        print(i - 1)
        exit()

print(10)

Submission status: Accepted

Solution code:
S = list(input())
a = [0] * len(S)
for i in range(len(S)):
    if S[i] in ['A','T','G','C']:
        a[i] += 1

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

Submission status: Accepted

Solution code:
S = input()
ans = 0
for left in range(len(S)):
    for right in range(left, len(S) + 1):
        tmp = S[left:right]
        for ch in tmp:
            if ch not in ('A', 'T', 'C', 'G'):
                break
        else:
            ans = max(ans, len(tmp))
print(ans)

Submission status: Accepted

Solution code:
import string


S = [input()]

for c in list(set(string.ascii_uppercase) - set(['A', 'T', 'G', 'C'])):
    S_tmp = []
    for s in S:
        S_tmp += s.split(c)
    S = S_tmp

print(max([len(s) for s in S]))

Submission status: Accepted

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

Submission status: Accepted

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

print(max)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

ans = 0
temp = 0

# import pdb;pdb.set_trace()
for s in S:
    if s=='A' or s=='C' or s=='G' or s=='T':
        temp += 1
    else:
        if ans<temp:
            ans = temp
        temp = 0
if ans<temp:
    ans = temp
        
print(ans)

Submission status: Accepted

Solution code:
import sys,heapq
from collections import deque,defaultdict
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG =  True
def ddprint(x):
  if DBG:
    print(x)

s = input()
mx = 0
cnt = 0
for i in range(len(s)):
    if s[i] in ['A', 'C', 'G', 'T']:
        cnt += 1
        if cnt > mx:
            mx = cnt
    else:
        cnt = 0

print(mx)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

strs = input()
check = ['A', 'G', 'C', 'T']

maxval = 0
cnt = 0
for s in strs:
    if s in check:
        cnt += 1
        if cnt > maxval:
            maxval = cnt
    else:
        cnt = 0
            
    
print(maxval)

Submission status: Accepted

Solution code:
S = list(input())
#print(S)
list = []
temp = ""
for i in range(len(S)):
    if S[i] == 'A' or S[i] == 'T' or S[i] == 'G' or S[i] == 'C':
        temp += S[i]
        list.append(temp)
    else:
        list.append(temp)
        temp = ""
#print(list)
ans = []
for i in range(len(list)):
    ans.append(len(list[i]))
#print(ans)
print(max(ans))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#122-B
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
S=S()
Q=["A","T","G","C"]
ans=0
cnt=0
for s in S:
    if s in Q:
        cnt+=1
    else:
        ans=max(ans,cnt)
        cnt=0
ans=max(ans,cnt)
print(ans)

Submission status: Accepted

Solution code:
import io, sys, atexit, os

import math as ma
from sys import exit
from decimal import Decimal as dec
from itertools import permutations


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


def num ():
	return map (int, input ().split ())


def nu ():
	return int (input ())


def find_gcd ( x, y ):
	while (y):
		x, y = y, x % y
	return x


mm = 1000000007



def solve ():
	t = 1
	for it in range (t):
		s=input()
		xp="ACGT"
		mx=0
		for i in range(len(s)):
			if(s[i] in xp):
				cc=0
				for j in range(i,len(s)):
					if(s[j] in xp):
						cc+=1
					else:
						break
				mx=max(mx,cc)
		print(mx)






if __name__ == "__main__":
	solve ()

Submission status: Accepted

Solution code:
b=input()
l=[]
i=0
num=0
while i<len(b):
    if b[i]=="A" or b[i]=="C" or b[i]=="G" or b[i]=="T":
        num+=1
    else:
        l.append(num)
        num=0
    i+=1
    l.append(num)
print(max(l))

Submission status: Accepted

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

Submission status: Accepted

Solution code:

S = [c for c in input()]

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

max_count = 0
for i in range(len(S)):
    count = 0
    for j in range(i, len(S)):
        if S[j] not in atgc:
            break
        count += 1
        
    if count > max_count:
        max_count = count
        
print(max_count)

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007


#A
def A():
    n = input()
    if n == "A":
        print("T")
    elif n == "C":
        print("G")
    elif n == "G":
        print("C")
    else:
        print("A")
    return

#B
def B():
    s = S()
    ans = 0
    n = len(s)
    for i in range(n):
        for j in range(i,n):
            f = 1
            for k in range(i,j+1):
                if s[k] not in list("AGCT"):f = 0
            if f:
                ans = max(ans,j+1-i)
    print(ans)
#C
def C():
    n,q = LI()

    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    B()

Submission status: Accepted

Solution code:
s = input()

ans = 0
tmp = 0
for i in s:
    if i == 'A' or i == 'T' or i == 'G' or i == 'C':
        tmp += 1
    else:
        tmp = 0

    if tmp > ans:
        ans = tmp

print(ans)