Problem:


Score : 200 points

Problem Statement

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

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

Notes

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

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

Constraints

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

Each character in S is an uppercase English letter.

Input

Input is given from Standard Input in the following format:

S

Output

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

Sample Input 1

ATCODER

Sample Output 1

3

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

Sample Input 2

HATAGAYA

Sample Output 2

5

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

Sample Input 3

SHINJUKU

Sample Output 3

0

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



Sample input:
ATCODER


Sample output:
3

Submission status: Accepted

Solution code:
import sys
# import bisect
# import math
# import itertools
# import numpy as np
# import collections

"""Template"""


class IP:
    """
    入力を取得するクラス
    """

    def __init__(self):
        self.input = sys.stdin.readline

    def I(self):
        """
        1文字の取得に使います
        :return: int
        """
        return int(self.input())

    def S(self):
        """
        1文字の取得(str
        :return: str
        """
        return self.input()

    def IL(self):
        """
        1行を空白で区切りリストにします(int
        :return: リスト
        """
        return list(map(int, self.input().split()))

    def SL(self):
        """
        1行の文字列を空白区切りでリストにします
        :return: リスト
        """
        return list(map(str, self.input().split()))

    def ILS(self, n):
        """
        1列丸々取得します(int
        :param n: 行数
        :return: リスト
        """
        return [int(self.input()) for _ in range(n)]

    def SLS(self, n):
        """
        1列丸々取得します（str
        :param n: 行数
        :return: リスト
        """
        return [self.input() for _ in range(n)]

    def SILS(self, n):
        """
        Some Int LineS
        横に複数、縦にも複数
        :param n: 行数
        :return: list
        """
        return [self.IL() for _ in range(n)]

    def SSLS(self, n):
        """
        Some String LineS
        :param n: 行数
        :return: list
        """
        return [self.SL() for _ in range(n)]


class Idea:
    def __init__(self):
        pass

    def HF(self, p):
        """
        Half enumeration
        半分全列挙です
        pの要素の和の組み合わせを作ります。
        ソート、重複削除行います
        :param p: list : 元となるリスト
        :return: list : 組み合わせられた和のリスト
        """
        return sorted(set(p[i] + p[j] for i in range(len(p)) for j in range(i, len(p))))

    def Bfs2(self, a):
        """
        bit_full_search2
        bit全探索の改良版
        全探索させたら2進数のリストと10進数のリストを返す
        :return: list２つ : １個目 2進数(16桁)  2個目 10進数
        """
        # 参考
        # https://blog.rossywhite.com/2018/08/06/bit-search/
        # https://atcoder.jp/contests/abc105/submissions/4088632
        value = []
        for i in range(1 << len(a)):
            output = []

            for j in range(len(a)):
                if self.bit_o(i, j):
                    """右からj+1番目のiが1かどうか判定"""
                    # output.append(a[j])
                    output.append(a[j])
            value.append([format(i, 'b').zfill(16), sum(output)])

        value.sort(key=lambda x: x[1])
        bin = [value[k][0] for k in range(len(value))]
        val = [value[k][1] for k in range(len(value))]
        return bin, val

    def S(self, s, r=0, m=-1):
        """
        ソート関係行います。色々な設定あります。
        :param s: 元となるリスト
        :param r: reversするかどうか 0=False 1=True
        :param m: （2次元配列）何番目のインデックスのソートなのか
        :return: None
        """
        r = bool(r)
        if m == -1:
            s.sort(reverse=r)
        else:
            s.sort(reverse=r, key=lambda x: x[m])

    def bit_n(self, a, b):
        """
        bit探索で使います。0以上のときにTrue出します
        自然数だからn
        :param a: int
        :param b: int
        :return: bool
        """
        return bool((a >> b & 1) > 0)

    def bit_o(self, a, b):
        """
        bit探索で使います。1のときにTrue出すよ
        oneで1
        :param a: int
        :param b: int
        :return: bool
        """
        return bool(((a >> b) & 1) == 1)

    def ceil(self, x, y):
        """
        Round up
        小数点切り上げ割り算
        :param x: int
        :param y: int
        :return: int
        """
        return -(-x // y)

    def ave(self, a):
        """
        平均を求めます
        :param a: list
        :return: int
        """
        return sum(a) / len(a)

    def gcd(self, x, y):
        if y == 0:
            return x
        else:
            return self.gcd(y, x % y)


"""ここからメインコード"""


def main():
    # 1文字に省略
    r, e = range, enumerate
    ip = IP()
    id = Idea()

    """この下から書いてね"""
    s = ip.S()
    ans = 0
    for i in r(len(s)):
        res = 0
        if s[i] == "A" or s[i] == "T" or s[i] == "C" or s[i] == "G":
            res += 1
            for j in r(1, len(s) - i):
                if s[i + j] == "A" or s[i + j] == "T" or s[i + j] == "C" or s[i + j] == "G":
                    res += 1
                else:
                    break

            ans = max(ans, res)
        else:
            pass

    print(ans)


main()

Submission status: Accepted

Solution code:
S = list(input())

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

Submission status: Accepted

Solution code:
s = list(input())
index=0
cout=0
maxC=0
flag=0
while index < len(s):
    if flag:
        if s[index] in ["A", "T", "G", "C"]:
            cout+=1
        else:
            if maxC < cout:
                maxC=cout
                cout=0
                flag=0
    else:
        if s[index] in ["A", "T", "G", "C"]:
            cout += 1
            flag=1
    index+=1
if maxC < cout:
    maxC = cout
print(maxC)

Submission status: Accepted

Solution code:
enki = list(input())
maxcount = 0
count = 0
for i in range(len(enki)):
    if enki[i] != "A" and enki[i] != "C" and enki[i] != "G" and enki[i] != "T":
        if maxcount < count:
            maxcount = count
        count = 0
    else:
        count = count + 1
        if i == len(enki) - 1:
            if maxcount < count:
                maxcount = count

print(maxcount)

Submission status: Accepted

Solution code:
s = (input())

def check(s):
    for c in s:
        if not(c in ("A","C","G","T")):
            break
    else:
        return True
    return False

out = 0
for i in range(len(s)+1):
    for j in range(i+1,len(s)+1):
        tmp = check(s[i:j])
        if tmp:
            out = max(out,j-i)
print(out)

Submission status: Accepted

Solution code:
S = input()

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

l = []
cnt = 0
for s in S:
    if s in acgt:
        cnt += 1
    else:
        l.append(cnt)
        cnt = 0

l.append(cnt)
print(max(l))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
count = 0
max_len = 0
flag = True
for i in s:
    if((i == "A") or (i == "G") or (i=="C") or (i == "T")) and flag:
        count+=1
        if max_len <= count:
            max_len = count
        flag = True
    else:
        count = 0
        flag = True
print(max_len)

Submission status: Accepted

Solution code:
s = input()

ans = 0
sLength = len(s)

point = 0
tmp = 0
while(point<sLength):
    if(s[point]=="A" or s[point]=="C" or s[point]=="G" or s[point]=="T"):
        tmp += 1
    else:
        tmp = 0
    point += 1
    if(tmp>ans):
        ans = tmp

print(ans)

Submission status: Accepted

Solution code:
S = input()
ans = 0
tmp = {"A","C","G","T"}
for i in range(len(S)):
    for j in range(i+1,len(S)+1):
        part = S[i:j]
        for s in set(part):
            if s not in tmp:
                break
        else:
            if len(part) > ans:
                ans = len(part)
print(ans)

Submission status: Accepted

Solution code:
S=input()
#A,B=map(int,input())
lst=["A","T","G","C"]
lst1=[0 for i in range(10)]
num=0
for i in S:
    if i in lst:
        lst1[num]+=1
        continue
    num+=1
print(max(lst1))

Submission status: Accepted

Solution code:
s = input()

ans = 0
ACGT = "ACGT"
for i in range(len(s)):
    count = 0
    for j in range(i, len(s), 1):
        if(s[j] in ACGT): count += 1
        else: break

    if(ans < count): ans = count

print(ans)

Submission status: Accepted

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

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] not in 'ATGC':
      break
    else:
      cnt += 1
  ans = max(ans, cnt)
print(ans)

Submission status: Accepted

Solution code:
S = input()
left = 0
right = len(S) - 1
ACGT = "ACGT"
acgt_index = []
for i in range(len(S)):
    if S[i] in ACGT:
        acgt_index.append(i)
if len(acgt_index) == 0:
    print(0)
    exit()
dif = [acgt_index[i + 1] - acgt_index[i] for i in range(len(acgt_index) - 1)]
ans = 0
now = 0
for i in dif:
    if i == 1:
        now += 1
        ans = max(ans, now)
    else:
        now = 0
print(ans+1)

Submission status: Accepted

Solution code:
s = input()
s = ''.join([i if i == 'A' or i == 'T' or i == 'G' or i == 'C' else ' ' for i in s]).split(' ')
print(max(map(len, s)))

Submission status: Accepted

Solution code:
line = list(input())
count, count_max = 0, 0
for b in line:
    if b == 'A' or b == 'T' or b == 'G' or b == 'C':
        count += 1
    else:
        count = 0
    if count > count_max:
        count_max = count
    
print(count_max)

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
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    b = S()
    b = b[0]
    if b == "A":
        print("T")
    elif b == "T":
        print("A")
    elif b == "C":
        print("G")
    elif b == "G":
        print("C")
    return

#B
def B():
    s = S()
    agct = ["A", "G", "C", "T"]
    ans = 0
    for num, i in enumerate(s):
        ansb = 0
        if i in agct:
            ansb += 1
            for k in range(num+1, len(s)):
                if s[k] in agct:
                    ansb += 1
                else:
                    break
        ans = max(ans, ansb)
    print(ans)
    return

#C
def C():
    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 = ["A","T","G","C"]
a = input()
max_size = 0
size = 0
for t in a:
	if t in s:
		size += 1
	else:
		if max_size < size:
			max_size = size
		size = 0
if max_size < size:
	max_size = size

print(max_size)

Submission status: Accepted

Solution code:
def solve(S):
    max_count = 0
    count = 0
    for i in range(len(S)):
        if S[i] in ["A", "G", "C", "T"]:
            count += 1
            if count > max_count:
                max_count = count
        else:
            count = 0
    return max_count


S = input()
print(solve(S))

Submission status: Accepted

Solution code:
S = str(input())

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

count_max = max(count, count_max)
print(count_max)

Submission status: Accepted

Solution code:
S = input()

MAXS = 0
SUMS = 0

for i in range(len(S)):
    if (S[i] == 'A' or S[i] == 'T' or S[i] == 'G' or S[i] == 'C' ):
        SUMS += 1
        if SUMS > MAXS :
            MAXS = SUMS
    else:
        SUMS = 0
        
print(MAXS)

Submission status: Accepted

Solution code:
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
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 I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True)

S = input()

result = 0
for start in range(0, len(S)):
    for i in range(1, 11):
        if start + i >= len(S)+1:
            break
        if all(s in ['A', 'T', 'C', 'G'] for s in S[start:start+i]):
            result = max(result, len(S[start:start+i]))
print(result)

Submission status: Accepted

Solution code:

import sys
input = sys.stdin.readline

S = input()

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

l = len(S)

acgt = []
a = ""

for i in range(l):
    if S[i] in d:
        a = a + S[i]
        if i == l-1:
            acgt.append(a)
    else:
        acgt.append(a)
        a = ""

max = 0

for a in acgt:
    if len(a) > max:
        max = len(a)

print(max)

Submission status: Accepted

Solution code:
n = list(input())

c = 0

k = ['A','G','C','T']
max = 0

for i in range(len(n)):
    if n[i] in k:
        c += 1
    else:
        c = 0
    
    if c > max:
        max = c
print(max)

Submission status: Accepted

Solution code:
def readln():
    return list(map(int, input().split()))


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

print(ans)

Submission status: Accepted

Solution code:
import copy

S = input()

S_list = [0] * len(S) 

for index, s in enumerate(S):
    if(s=="A" or s=="C" or s=="G" or s=="T"):
        S_list[index] = 1

max_counter = 0
counter = 0
for i in range(len(S)):
    if(S_list[i]==1):
        counter+=1
        if(counter > max_counter):
            max_counter = copy.deepcopy(counter)
    else:
        counter = 0

print(max_counter)

Submission status: Accepted

Solution code:
def is_acgt(s):
    for char in s_sub:
        if char not in {'A', 'T', 'G', 'C'}:
            return False
    return True

S = input()
length = len(S)
ans = 0
for i in range(length):
    for j in range(i + 1, length + 1):
        s_sub = S[i:j]
        if is_acgt(s_sub):
            ans = max(ans, len(s_sub))

print(ans)

Submission status: Accepted

Solution code:
def main():
  S = input()
  L = ['A', 'C', 'G', 'T']
  res = 0
  
  count = 0
  for i in range(len(S)):
    if S[i] in L:
      count += 1
    else:
      if (res < count):
        res = count
      count = 0

  if (res < count):
    res = count
  print(res)
main()

Submission status: Accepted

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

def main(S):
    cnt = 0
    m = 0
    for s in S:
        if s not in acgt:
            cnt = 0
        else:
            cnt += 1
        m = max(m, cnt)
    return m

print(main(S))

Submission status: Accepted

Solution code:
char = input()
count = 0
max = 0
for i in range(len(char)):
  if char[i] in list('ATCG'):
    count += 1
    if count > max:
      max = count
  else:
    count = 0

print(max)

Submission status: Accepted

Solution code:
S = input()
N = len(S)
longest = 0
current = 0
for c in S:
    if c not in 'ATGC':
        current = 0
    else:
        current += 1
        if current > longest:
            longest = current
print(longest)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
B = input()
ACGT = ["A","C","G","T"]
temp = 0
ans = 0
for b,i in zip(B,range(len(B))):
    
    if ACGT.__contains__(b):
        temp += 1
    else:
        temp = 0
    if temp > ans:
        ans = temp
print(ans)

Submission status: Accepted

Solution code:
S = input()
S_tmp = []
for c in S:    
    if c in "ACGT":
        S_tmp.append(1)   
    else:
        S_tmp.append(0)    
        
ans = 0 
for l in range(len(S)):
    for r in range(l+1,len(S)+1):
        if sum(S_tmp[l:r])==(r-l):
            ans = max(ans,r-l)
print(ans)

Submission status: Accepted

Solution code:
S = str(input())

dp = []
dp.append(0)
for i, s in enumerate(S, start=1):
    if s in ["A", "C", "G", "T"]:
        dp.append(dp[i-1] + 1)
    else:
        dp.append(0)
print(max(dp))

Submission status: Accepted

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

for item in s:
  if item == "A" or item == "C" or item == "G" or item == "T":
    is_acgt.append(1)
  else:
    is_acgt.append(0)


ans = 0
count = 0
for item in is_acgt:
  if item == 1:
    count += 1
    ans = max(ans, count)
  else:
    count = 0
  
print(ans)

Submission status: Accepted

Solution code:
import re

x = input()
match = re.findall('[ACGT]+', x)

if match:
    print(max([len(x) for x in match]))
else:
    print(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
i = len(S)
def isOK(string):
    for c in string:
        if c not in ["A","G","T","C"]:
            return(False)
    return(True)
while i > 0:
    d = len(S) - i
    for j in range(d+1):
        string = S[j:j+i]
        if isOK(string): 
            print(i)
            exit()
    i -= 1
print(i)

Submission status: Accepted

Solution code:
n=input()
record=0
swit=0
atgc=['A', 'T', 'G', 'C']
for i in range(len(n)):
    if n[i] in atgc:
        swit+=1
        if swit>record:
            record=swit
    else:
        swit=0
        if swit>record:
            record=swit
print(record)

Submission status: Accepted

Solution code:
S = list(input())
List = set(["A", "T", "G", "C"])
cnt = 0
ResMax = 0

for i in S:
    if i in List:
        cnt += 1
    else:
        if cnt > ResMax:
            ResMax = cnt
        cnt = 0

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

Submission status: Accepted

Solution code:
s = input()

_s = s
acgt = ["A","C", "G", "T"]
ans = 0
for i in range(10):
    for j in range(i+1, 11):
        _s = s[i:j]
        if all([__s in acgt for __s in _s]) and len(_s) >= ans:
            ans = len(_s)
print(ans)

Submission status: Accepted

Solution code:
s = input()
ans = 0
for i in range(len(s)):
    c = i
    while c < len(s) and s[c] in ['A', 'C', 'T', 'G']:
        c += 1
    t = c-i

    if ans < t:
        ans = t
print(ans)

Submission status: Accepted

Solution code:
s = input()
count = 0
max_count = 0
for i in s:
    if i in {'A', 'T', 'G', "C"}:
        count += 1
        if count > max_count:
            max_count = count
    else:
        count = 0
print(max_count)

Submission status: Accepted

Solution code:
s=input()
N = len(s)
score = 0
record = 0
for i in range(N):
    if s[i] in "AGCT":
        score += 1
    else:
        if record <= score:
            record = score
        score = 0

if record <= score:
    record = score

print(record)

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] in ['A', 'C', 'G', 'T']:
            cnt += 1
        else:
            break
    ans = max(ans, cnt)
    
print(ans)

Submission status: Accepted

Solution code:
S = input()

arr = [[]]
renzoku = True
for char in S:
    if char in ["A","C", "G", "T"]:
        if renzoku:
            arr[-1].append(char)
        else:
            arr.append([char])
            renzoku = True
    else:
        renzoku = False

leng = []
for a in arr:
    leng.append(len(a))
print(max(leng))

Submission status: Accepted

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

Submission status: Accepted

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

from itertools import chain
from functools import reduce
from collections import OrderedDict, Counter, deque
import operator

IS = lambda: int(input())
IA = lambda: [int(x) for x in input().split()]
IM = lambda N: [IA() for _ in range(N)]

s = input()
d = set("ACGT")

ans = 0
cur = 0
for x in s:
    if x in d:
        cur += 1
        ans = max(ans, cur)
    else:
        cur = 0
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

count = 0
max_count = 0
for i in s:
    if i in acgt:
        count += 1
    else:
        if count > max_count:
            max_count = count
        count = 0
else:
    if count > max_count:
        max_count = count
        
print(max_count)

Submission status: Accepted

Solution code:
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

a = list(input())
mx = 0
for i in range(len(a)):
    count = 0
    for j in range(i, len(a)):
        if a[j] == "A" or a[j] == "C" or a[j] == "G" or a[j] == "T":
            count += 1
        else:
            break
    mx = max(mx, count)
print(mx)

Submission status: Accepted

Solution code:
S = input()

ans = 0
tmp = 0
ATCG = ["A", "T", "C", "G"]

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

print(ans)

Submission status: Accepted

Solution code:
# 2019/03/24
# AtCoder Beginner Contest 122 - B

# Input
s = input()

ans = 0
wcnt = 0
for idx in range(len(s)):
    if s[idx] == "A" or s[idx] == "C" or s[idx] == "T" or s[idx] == "G":
        wcnt += 1
        if ans < wcnt:
            ans = wcnt
    else:
        wcnt = 0

# Output
print(ans)

Submission status: Accepted

Solution code:
s=input()

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

count=0
max_count=0
for i in s:
    if check(i):
        count+=1
    else:
        
        max_count=max(max_count,count)
        count=0

print(max(max_count,count))

Submission status: Accepted

Solution code:
# coding: utf-8
S = input()
ans = 0
c = 0
for s in S:
    if s in ['A', 'T', 'G', 'C']:
        c += 1
        ans = max(c, ans)
    else:
        c = 0
print(ans)

Submission status: Accepted

Solution code:
s=list(input())	
tmp = 0
ans = 0
for word in s:
    if word == "A":
        tmp += 1
    elif word == "T":
        tmp += 1
    elif word == "G":
        tmp += 1
    elif word == "C":
        tmp += 1
    else:
        tmp = 0
    if ans < tmp :
        ans = tmp

print(ans)

Submission status: Accepted

Solution code:
x = input()

count = 0
max_c = 0
set = ["A", "T", "C", "G"]
for i in x:
    if i in set:
        count += 1
    else:
        count = 0
    max_c = max(max_c, count)

print(max_c)

Submission status: Accepted

Solution code:


S = input()
m = 0

count = 0
for c in S:
    if c in "ACGT":
        count += 1
    else:
        m = max(count, m)
        count = 0

m = max(count, m)
print(m)

Submission status: Accepted

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

S = input()
mx = 0

for i in range(len(S)):
    cnt = 0
    j = i
    while j < len(S) and (S[j] == "A" or S[j] == "T" or S[j] == "C" or S[j] == "G"):
        cnt += 1
        j += 1
    if cnt > mx:
        mx = cnt

print(mx)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input().strip()
_max = 0
now = 0
for c in S:
  if c in 'ACGT':
    now += 1
  else:
    _max = max(_max, now)
    now = 0
print(max(_max, now))

Submission status: Accepted

Solution code:
a = "ACTG"
s = input()
n = len(s)
ans = 0
for i in range(n):
    for j in range(i, n + 1):
        if j == n or a.find(s[j]) == -1:
            ans = max(ans, j - i)
            break
print(ans)

Submission status: Accepted

Solution code:
s = input()
x = len(s)

ans = 0
for i in range(x):
    for j in range(i + 1, x + 1):
        t = s[i:j]
        y = len(t)
        for ss in 'ACGT':
            t = t.replace(ss, '')
        if t == '':
            ans = max(ans, y)
print(ans)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
def acgt(t):
    if len(t) == 0:
        return 1
    if t[0] in ["A", "C", "G", "T"]:
        return acgt(t[1:])
    return 0
    
s = input() + "."*100
ans = 0
for l in range(20):
    for i in range(20):
        if acgt(s[i:i+l]):
            ans = l

print(ans)

Submission status: Accepted

Solution code:
S = input()
S = S.replace('A', '*').replace('T', '*').replace('C', '*').replace('G', '*')

ans, count = 0, 0
for s in S:
    if s == '*':
        count += 1
        ans = max(ans, count)
    else:
        count = 0

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

max_len = 0
for start in range(len(S)):
    for end in range(start + 1, len(S) + 1):
        if all(char in valid_chars for char in S[start:end]):
            max_len = max(max_len, end - start)
print(max_len)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
n = len(s)
r,ans=0,0
for l in range(n):
    while r<n and (s[r]=="A" or s[r]=="T" or s[r]=="G" or s[r]=="C"):
        r+=1
    ans = max(ans,r-l)
    if r==l: r+=1
print(ans)

Submission status: Accepted

Solution code:
s = input()

l = list(s)

p = []
m = 0

for i in range(0,len(l)):
    if l[i] == "A" or l[i] == "T" or l[i] == "G" or l[i] == "C":
        p.append(l[i])
        if len(p) > m:
            m = len(p)
    else:
        p = []

print(m)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools


s = input()

p = 'ATGC'

s = [x in p for x in s]

res = 0
for key, group in itertools.groupby(s):
  if key == 1:
    res = max(res, len(list(group)))
print(res)

Submission status: Accepted

Solution code:
from sys import exit

S = input()

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

if temp_ans > ans:
    ans = temp_ans

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

s = S()
acgt = ["A","C","G","T"]

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

print(ans)

Submission status: Accepted

Solution code:
string = input()


ans = 0
section = 0
for i in range(len(string)):
	if string[i] in 'ATGC':
		section += 1
	else:
		if ans < section:
			ans = section
		section = 0

if ans < section:
	ans = section

print(ans)

Submission status: Accepted

Solution code:
N = input()

maxn = 0
cnt = 0
for i in N:
    if i == "A" or i == "T" or i == "G" or i == "C":
        cnt += 1
    else:
        if maxn < cnt:
            maxn = cnt
        cnt = 0

if maxn < cnt:
    maxn = cnt

print(maxn)

Submission status: Accepted

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

Submission status: Accepted

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