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).

Solution (Python):
s = input()
s_list = list(s)
a_list = ['A','C','G','T']
c = 0
ans = 0
k = 0
for hoge in s_list:
  if hoge in a_list:
    c += 1
  else:
    ans = max(ans,c)
    c = 0
  k += 1
  if k == len(s_list):
    ans = max(ans,c)
print(ans)

Solution (Python):
def solve(S):
    ret = 0
    tmp_ret = 0
    for s in S:
        if s in ["A", "T", "C", "G"]:
           tmp_ret += 1
        else:
            ret = max(ret, tmp_ret)
            tmp_ret = 0
    ret = max(ret, tmp_ret)
    return ret

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

Solution (Python):

def main():
    import sys
    S = sys.stdin.readline().rstrip()
    
    L = ['A', 'C', 'G', 'T']
    cnt, ans = 0, 0
    for s in S:
        if s in L:
            cnt+=1
        else:
            if ans < cnt:
                ans = cnt
            
            cnt=0
    else:
        if ans < cnt:
            ans = cnt
    print(ans)


if __name__=='__main__':
    main()

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()


def main():
    S = input() + 'Z'
    flag = False
    length = 0
    ans = 0
    for i, c in enumerate(S):
        if flag and (c == 'A' or c == 'T' or c == 'C' or c == 'G'):
            length += 1
        elif flag:
            ans = max(ans, length)
            length = 0
            flag = False
        elif c == 'A' or c == 'T' or c == 'C' or c == 'G':
            flag = True
            length = 1
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import math
def py():
    print("Yes")
def pn():
    print("No")
def iin():
    x = int(input())
    return x

neko = 0
nya = 0
nuko = 0

s = input()
for i in range(len(s)):
    if s[i] in ['A','C','G','T']:
        f = 1
    else:
        f = 0
    if f:
        neko = neko + 1
    if nya < neko:
        nya = neko
    if f == 0:
        neko = 0
print(nya)

Solution (Python):
s=input()
a="AGCT"
c=0
mc=0
for i in s:
    if i in a:
        c+=1
    else:
        if c>mc:
            mc=c
        c=0
if c>mc:
    mc=c
print(mc)

Solution (Python):
l = ["A","T","G","C"]
cnt = []
s = input()
c = 0
flag = 0
for i in range(len(s)):
  if s[i] not in l:
    cnt.append(c)
    c = 0
  else:
    c += 1
cnt.append(c)
print(max(cnt))

Solution (Python):
S = input()

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

print(ans)

Solution (Python):
s = input()
max = 0
for i in range(len(s)):
    c = 0
    if s[i] != 'A' and s[i] != 'T' and s[i] != 'G' and s[i] != 'C':
        continue
    c += 1
    for j in range(i + 1, len(s)):
        if s[j] == 'A' or s[j] == 'T' or s[j] == 'G' or s[j] == 'C':
            c += 1
        else:
            break
    if max < c:
         max = c
print(max)

Solution (Python):
s=input()
ans=0
for i in range(len(s)):
  cnt=0
  for j in range(i,len(s)):
    if s[j]!="A" and s[j]!="T" and s[j]!="C" and s[j]!="G":
      break
    else:
      cnt+=1
  if ans<=cnt:
    ans=cnt
print(ans)

Solution (Python):
import copy

S = list(input())
tmp = 0
count = 0

for s in S:
    if s == 'A' or s == 'C' or s == 'G' or s == 'T':
        tmp += 1
        if count < tmp:
            count = copy.copy(tmp)
    else:
        tmp = 0

print(count)

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

Solution (Python):


import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))


def resolve():
    S=input()
    s="AGCT"
    cnt=0
    ans=0
    for i in range(len(S)):
        if S[i] in s:
            cnt+=1
        else:
            ans=max(ans,cnt)
            cnt=0
    ans=max(ans,cnt)
    print(ans)


resolve()

Solution (Python):
s = input()

max_len = 0
len_tmp = 0
for i in s:
    if i in "ATGC":
        len_tmp += 1
    else:
        max_len = max(max_len, len_tmp)
        len_tmp = 0
print(max(max_len, len_tmp))

Solution (Python):
s = input()
dum = ["A","C","G","T"]
ans = 0
ct = 0
for i in s:
    if dum.count(i) == 1:
        ct += 1
    else:
        ct = 0
    ans = max(ct,ans)
print(ans)

Solution (Python):
S = input()
L = ['A', 'C', 'G', 'T']
ans = 0
for i in range(len(S)):
    for j in range(len(S) - i):
        if j == 0:
            s = S[i:]
        else:
            s = S[i:-j]
        length = 0
        for k in s:
            if k in L:
                length += 1
            else:
                length = 0
                break
        if ans < length:
            ans = length
print(ans)

Solution (Python):
s = input()
import itertools
def judge(k):
    if s[k] == "A" or s[k] == "C" or s[k] == "G" or s[k] == "T":
        return True
    return False

ans = 0
for comb in itertools.combinations(range(len(s)),2):
    i,j = comb
    true = 1
    for k in range(i,j+1):
        if not judge(k):
            true = 0
            break
    if true == 1:
        ans = max(ans,j-i+1)
if ans == 0:
    for k in range(len(s)):
        if judge(k):
            ans = 1
            break
print(ans)

Solution (Python):
s=input()

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

res=max(res,cnt)
print(res)

Solution (Python):
s = input()
dp = [0]*(len(s) + 1)

for i, x in enumerate(s):
    if x in "ACGT":
        dp[i+1] = dp[i] + 1
print(max(dp))

Solution (Python):
s = input()
ans, temp = 0, 0
for x in s:
    if x in "ACGT":
        temp += 1
    else:
        temp = 0
    ans = max(ans, temp)

print(ans)

Solution (Python):
S = input()
n= len(S)
m = 0
def isACGT(str):
    return all(list(map(lambda c: c in 'ATCG', str)))

for i in range(n):
    for j in range(i+1, n+1):
        if isACGT(S[i:j]):
            m = max(m, j-i)

print(m)

Solution (Python):
def is_acgt(s):
    for c in s:
        if c not in ["A", "C", "G", "T"]:
            return False
    return True


S = input()
ml = 0
for l in range(len(S)+1):
    for r in reversed(range(len(S)+1)):
        if l <= r and is_acgt(S[l:r]):
            ml = max(ml, r-l)
print(ml)

Solution (Python):
def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [[input().split()] for _ in range(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

s=s0()

ans=0
c=0
for x in s:
    if x in "ACGT":
        c+=1
    else:
        c=0
    ans=max(ans,c)
print(ans)

Solution (Python):
def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [[input().split()] for _ in range(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

s=s0()

ans=0
c=0
for x in s:
    if x in "ACGT":
        c+=1
    else:
        ans=max(ans,c)
        c=0
ans=max(ans,c)
print(ans)

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

Solution (Python):
import bisect
import math
import sys
from collections import Counter, defaultdict, deque
from copy import copy, deepcopy
from heapq import heapify, heappop, heappush
from itertools import combinations, permutations
from queue import Queue

read = sys.stdin.read
readline = sys.stdin.readline 
readlines = sys.stdin.readlines 

inf = float("inf")


def count(S):
    ret = 0
    for s in S:
        if s in 'AGCT':
            ret += 1
        else:
            return 0
    return ret

def main():
    S = input()
    length = len(S)
    ret = 0
    
    for i in range(length):
        if i == 0:
            ret = count(S)
        else:
            for j in range(i+1):
                _S = S[j:length-(i-j)]        
                ret = max(ret, count(_S))
                
    print(ret)
        
      
if __name__=='__main__':
    main()

Solution (Python):
def main():
    from sys import stdin
    s = str(stdin.readline().rstrip())
    n = len(s)
    dp = [0]*(n+1)
    g = set({"A","T","C","G"})
    l ="0"+s
    for i in range(1,n+1):
        if l[i] in g:
            dp[i]=dp[i-1]+1
        else:
            dp[i]=0
    
    print(max(dp))
main()

Solution (Python):
S= str(input())



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

Solution (Python):
import sys

input = sys.stdin.readline

def main():
    t = 'ATGC'
    ans = 0
    S = input()
    temp = 0
    for s in S:
        if s in t:
            temp += 1
        else:
            ans = max(ans, temp)
            temp = 0

    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
import sys

input = sys.stdin.readline

def main():
    t = 'ATGC'
    ans = 0
    s = input()
    temp = 0
    for i in range(len(s)):
        temp = 0
        if s[i] in t:
            temp += 1
            for j in range(i+1, len(s)):
                if s[j] in t:
                    temp += 1
                else:
                    break
            ans = max(ans, temp)

    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
S = input()
S+='*'
sm = 0
ans = 0
for s in S:
    if s in ('A','C','G','T'):
        sm += 1
    else:
        ans = max(ans, sm)
        sm = 0
print (ans)

Solution (Python):
s = input()
n = len(s)
l = ['A','C','G','T']
ans = 0
a = 0
for i in range(n):
    if s[i] in l:
        a += 1
    else:
        a = 0
    ans = max(ans,a)
print(ans)

Solution (Python):
S = input()

cnt = 0
ml = 0

for i in range (len(S)):
  cnt = 0
  for j in range(i+1, len(S)+1):
    cnt = S[i:j].count("A") + S[i:j].count("T") + S[i:j].count("G") + S[i:j].count("C") 
    
    if cnt == len(S[i:j]) and cnt > ml:
      ml = cnt
  
print(ml)

Solution (Python):
s = input()

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

max_len = 0
cnt = 0
for i in s:
    if i in acgt:
        cnt += 1
        if max_len < cnt:
            max_len = cnt
    else:
        cnt = 0
print(max_len)

Solution (Python):
N = (input())
acgt = ['A','C','G','T']
ans = 0
for i in range(len(N)+1):
    for j in range(i+1,len(N)+1):
        if len(N[i:j]) == sum([1 for k in N[i:j] if k in acgt]):
            ans = max(ans , len(N[i:j]))
print(ans)

Solution (Python):
S = input()
ACGT = ['A','C','G','T']
NS = []
for i in S:
    if i in ACGT:
        NS.append('A')
    else:
        NS.append(' ')
L = ''.join(NS).split()
max_l = 0
for l in L:
    max_l = max(max_l, len(l))
print(max_l)

Solution (Python):
S = input()
N = len(S)
s = {"A", "T", "C", "G"}

ans = 0
for i in range(N):
    for j in range(i, N):
        if all([c in s for c in S[i:j+1]]):
            ans = max(ans, j-i+1)
print(ans)

Solution (Python):
S = input()

ACGT = ('A', 'C', 'G', 'T')

def is_ACGT(string):
  for c in string:
    if c not in ACGT:
      return False
  return True


max_len = 0
for i in range(len(S)+1):
  for j in range(i+1, len(S)+1):
    sub = S[i:j]
    if is_ACGT(sub):
      max_len = max(max_len, len(sub))

print(max_len)

Solution (Python):


def main():
    s = input()
    res = 0
    for i in range(len(s)):
        for j in range(i, len(s)):
            if all("ACGT".count(c) == 1 for c in s[i:j+1]):
                res = max(res, j-i+1)
    print(res)

if __name__ == "__main__":
    main()

Solution (Python):
s = list(input())
l = []
for i in range(len(s)):
    j = i
    

    cnt = 0
    if s[i] in ["A",'C','G','T']:
        cnt +=1
        while j <= len(s)-2 :
            j = j + 1    
            if s[j] in ["A",'C','G','T']:
                cnt += 1
            else:
                break
    l.append(cnt)
print(max(l))

Solution (Python):
S=str(input())
M=['A','C','G','T']
c=0
cmax=0
for i in range(len(S)):
  if S[i] in M:
    c+=1
  else:
    if c>cmax:
      cmax=c
    c=0
print(max(c,cmax))

Solution (Python):
S = input()
ans = 0
count = 0

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

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

s = list()
for i in range(N):
    if S[i] == "A" or S[i] == "T" or S[i] == "G" or S[i] == "C":
        s.append(1)
    else:
        s.append(0)


lz = list()
cnt = 0
for i in range(N):
    if s[i] == 1:
        if cnt == 0:
            cnt = 1
        else:
            cnt += 1
    else:
        lz.append(cnt)
        cnt = 0
lz.append(cnt)
print(max(lz))

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

Solution (Python):
S = input()
ans = 0
acgt = ['A', 'C', 'G', 'T']
for i in range(len(S)):
    for j in range(i+1, len(S)+1):
        s = S[i:j]
        tmp = 0
        for ss in s:
            if ss not in acgt: break
            tmp += 1
        ans = max(ans, tmp)
print(ans)

Solution (Python):
def solve():
    S = input()
    ans = 0
    serial = 0
    for s in S:
        if s in 'ATGC':
            serial += 1
        else:
            ans = max(ans,serial)
            serial = 0
    ans = max(ans,serial)
    return ans
print(solve())

Solution (Python):
l=list(input())
N=len(l)
Long=list()
for i in range(N):
  long=0
  for x in range(i,N):
    if l[x]=='A' or l[x]=='T' or l[x]=='C' or l[x]=='G':
      long+=1
    else:
      break
    Long.append(long)
if len(Long)==0:
  print('0')
else:
  print(max(Long))

Solution (Python):
s = input()
s += "B"

max_len = 0

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

print(max_len)

Solution (Python):
s = input()

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

tmp_ans = 0
ans = 0
for c in s:
    if c in valid_chars:
        tmp_ans += 1
        ans = max(tmp_ans, ans)
    else:
        tmp_ans = 0

print(ans)

Solution (Python):

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

Solution (Python):
S = list(input())

length_max = 0
for i in range(len(S)):
    if S[i] in ["A", "G", "C", "T"]:
        length = 1
        for j in range(i+1, len(S)):
            if S[j] in ["A", "G", "C", "T"]:
                length += 1
            else:
                break
        if length > length_max:
            length_max = length
print(length_max)

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

Solution (Python):
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt, ceil
from functools import lru_cache, reduce
INF = 1 << 60
MOD = 1000000007
sys.setrecursionlimit(10 ** 7)


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True




def warshall_floyd(d, n):
    
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d



def dijkstra_heap(s, edge, n):
    
    d = [10**20] * n
    used = [True] * n 
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


def lcm(x, y):
    return (x * y) // gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm, numbers, 1)


def gcd_list(numbers):
    return reduce(gcd, numbers)






def eratosthenes(limit):
    A = [i for i in range(2, limit+1)]
    P = []

    while True:
        prime = min(A)
        
        if prime > sqrt(limit):
            break
            
        P.append(prime)
            
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
            
    for a in A:
        P.append(a)
            
    return P


def permutation_with_duplicates(L):

    if L == []:
        return [[]]

    else:
        ret = []

        
        S = sorted(set(L))

        for i in S:

            data = L[:]
            data.remove(i)

            for j in permutation_with_duplicates(data):
                ret.append([i] + j)

        return ret



s = input()
n = len(s)
ans = 0
for i in range(n):
    for j in range(i + 1, n + 1):
        t = s[i : j]
        ok = True
        for k in t:
            if k not in ["A", "C", "G", "T"]:
                ok = False
                break
        if ok:
            ans = max(ans, j - i)
print(ans)

Solution (Python):

"""
Created on Fri May  8 01:38:54 2020

@author: Kanaru Sato
"""

s = list(input())
count = 0
ans = 0

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

print(ans)

Solution (Python):
S = input()
ml = 0
cnt = 0

for i in range (len(S)):
  cnt = 0
  for j in range (i+1, len(S)+1):
    cnt = S[i:j].count("A")+ S[i:j].count("T")+ S[i:j].count("G")+ S[i:j].count("C")
   
    if cnt == len(S[i:j]) and cnt > ml:
      ml = cnt
      
print(ml)

Solution (Python):
S = input()

max_len = 0
counter = 0
for i in S:
    if i in 'ACGT':
        counter += 1
        if max_len < counter:
            max_len = counter

    else:
        counter = 0
    

print(max_len)

Solution (Python):
S = input()
cnt = 0
ml = 0
for i in range (len(S)):
  
  for j in range (i+1, len(S)+1):
    cnt = S[i:j].count("A") + S[i:j].count("T") + S[i:j].count("G") + S[i:j].count("C")    
    if len(S[i:j]) == cnt and cnt > ml:
      ml = cnt
    
print(ml)

Solution (Python):
s = input()
temp = []
maximum = 0
count =0
for i in range(len(s)):
    if s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T':
            count +=1
            maximum = max(maximum,count)
    else:
        count = 0

print(maximum)

Solution (Python):
s = str(input())

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

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

score = max(score,tmp)
print(score)

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

Solution (Python):
s=input()
l=len(s)

res=0
cnt=0

for i in range(l):
	t=s[i]
	if t=="A" or t=="T" or t=="C" or t=="G":
		cnt+=1
	else:
		res=max(res,cnt)
		cnt=0

res=max(res,cnt)
print(res)

Solution (Python):
s=input()
gene = ["A","T","G","C"]
ans=0
counter=0
for i in range(len(s)):
	for j in range(i,len(s)):
		if(s[j] in gene):
			counter += 1
		else:
			if(counter > ans):
				ans=counter
			counter=0
			break
	if(counter > ans):
		ans=counter
	counter=0
print(ans)

Solution (Python):
S = input()
cnt = 0
ml = 0

for i in range(len(S)):
  for j in range (i+1, len(S)+1):
    cnt = S[i:j].count("A") + S[i:j].count("T") + S[i:j].count("G") + S[i:j].count("C")
    if cnt == len(S[i:j]) and cnt > ml:
      ml = cnt
      
    
print(ml)

Solution (Python):
s=input()
ans=0
ans_lis=[]
for i in range(len(s)):
    if s[i] in "ACGT":
        ans=ans+1
    else:
        ans_lis.append(ans)
        ans=0
ans_lis.append(ans)
print(max(ans_lis))

Solution (Python):
def resolve():
    import re
    span = [len(i) for i in re.findall('[ACGT]*', str(input()))]
    if span:
        print(max(span))
    else:
        print(0)


resolve()

Solution (Python):
s = input()
dic = set(['A','T','G','C'])
count = 0
ans = 0
for char in s:
  if char in dic:
    count += 1
  else:
    ans = max(ans,count)
    count = 0

print(max(ans,count))

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

S = input()
N = len(S)

ans = 0
for i in range(N):
    if S[i] not in ["A", "C", "G", "T"]:
        continue
    s = S[i]
    for j in range(i+1, N):
        if S[j] not in ["A", "C", "G", "T"]:
           break 
        s += S[j]
    ans = max(ans, len(s))
print(ans)

Solution (Python):
s = input()

cnt = 0
max_cnt = 0

for i in range(len(s)):
    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
        cnt += 1
    else:
        cnt = 0
    if max_cnt < cnt:
        max_cnt = cnt

print(max_cnt)

Solution (Python):
s =str(input())
ans = 0
aa = []
if s[0] in ['A', 'C', 'G', 'T']:
    ans =1
for i in range(1,len(s)):
    if s[i] in ['A', 'C', 'G', 'T']:
        if s[i-1] in ['A', 'C', 'G', 'T']:
            ans += 1
        else:ans = 1
    else:
        aa.append(ans)
        ans = 0
aa.append(ans)
print(max(aa))

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

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

Solution (Python):
s=input()
n=len(s)
ans=""
res=[]
for i in range(n):
    if s[i]=="A" or s[i]=="T" or s[i]=="G" or  s[i]=="C":
        ans+=s[i]
    else:
        if ans!="":
            res.append(ans)
        ans=""
        continue
res.append(ans)
if not res:
    print(0)
    exit()
print(len(max(res, key=len)))

Solution (Python):
s=input()
n=len(s)
ans=0
for i in range(n):
    for j in range(i,n):
        if all("ACGT".count(c)==1 for c in s[i:j+1]):
            ans = max(ans,j-i+1)
print(ans)

Solution (Python):
S = list(input())
L = ['A','C','G','T']
c = 0
ans = 0

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

print(ans)

Solution (Python):
S = list(input())
L = ['A','C','G','T']
c = 0
ans = 0

for i in S:
    if i in L:
        c += 1
        if ans < c:
            ans = c
    else:
        c = 0

print(ans)

Solution (Python):
S = list(input())

c = 0
ans = 0

for i in S:
    if i=='A' or i=='C' or i=='G' or i=='T':
        c += 1
        if ans < c:
            ans = c
    else:
        c = 0

print(ans)

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

Solution (Python):
S = input()
n = len(S)
ATGC = set(['A', 'T', 'G', 'C'])
ans = 0
for i in range(n):
    for j in range(i+1, n+1):
        tmp_s = S[i:j]
        if len(set(tmp_s) - ATGC) == 0:
            ans = max(ans, j-i)
print(ans)

Solution (Python):
S = input()
l = {"A", "C", "G", "T"}

ans = 0
tmp = ""
for s in S:
  if s in l:
    tmp += s
    if len(tmp) > ans:
      ans = len(tmp)
  else:
    tmp = ""

print(ans)

Solution (Python):
S = input()

res = []
tmp = []
for s in S:
    if s == 'A' or s == 'C' or s == 'G' or s == 'T':
        tmp.append(s)
    else:
        res.append(len(tmp))
        tmp = []
res.append(len(tmp))
print(max(res))

Solution (Python):
string = input()
lis = ["A","C","G","T"]

result  = 0
flag = 0
for i in string:
    if i in lis:
        flag +=1
    else :
        flag = 0
    if result <= flag :
        result = flag
print(result)

Solution (Python):
S = input()
T = "ACGT"
ans = 0
cnt = 0
for s in S:
    if s in T:
        cnt += 1
    else:
        if cnt > ans:
            ans = cnt
        cnt = 0
if cnt>ans:
    ans = cnt
print(ans)

Solution (Python):
s = [i for i in input()]
atgc = {"A","T","G","C"}
tmp = 0
lng = 0
for p in s:
  if p in atgc:
    tmp += 1
  else:
    if tmp > lng:
      lng = tmp
    tmp = 0
if tmp > lng:
  lng = tmp
print(lng)

Solution (Python):
S=input()
sum,ans=0,[0]

for s in S:
  if s in "ACGT":
    sum += 1
  else:
    ans.append(sum)
    sum = 0
print(max(max(ans),sum))

Solution (Python):
s = input()

max_len = 0
counter = 0

for s_i in s:
  if s_i in ['A','C','G','T']:
    counter += 1
  else:
    counter = 0
  max_len = max(max_len, counter)
  
print(max_len)

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

Solution (Python):
S = input()

max = 0
now = 0

for i in S:
    if i in ["A", "C", "G", "T"]:
        now += 1
    else :
        now = 0
    
    if max < now:
        max = now
        
print(max)

Solution (Python):
S = input()

result = 0
count = 0

for i in range(len(S)):
    if S[i] == 'A' or S[i] == 'C' or S[i] == 'G' or S[i] == 'T':
        count += 1
    else:
        count = 0
    if result < count:
        result = count

print(result)

Solution (Python):
a=input()
ct=[0]*10
hantei=0
ct2=0
for i in a:
    if (hantei==1):
        if i in'ACGT':
            ct[ct2]+=1
        else:
            hantei=0
            ct2+=1
    else:
        if i in 'ACGT':
            ct[ct2]+=1
            hantei=1
print(max(ct))

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

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

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

Solution (Python):
S = list(input())
S.append('')
res = []
count = 0
for i in S:
  if i in ['A', 'T', 'G', 'C']:
    count += 1
  else:
    res.append(count)
    count = 0
print(max(res))

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

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

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

Solution (Python):
stng = input()
curlen = 0
maxlen = 0
for s in stng:
  if s=='A' or s=='T' or s=='C' or s=='G':
    curlen += 1
    maxlen = max(maxlen,curlen)
  else:
    curlen = 0
print(maxlen)

Solution (Python):
s = input()
AT = "ACGT"
ans = 0
tmp = 0
for i in range(len(s)):
  if s[i] in AT:
    tmp += 1
  else:  
    ans = max(ans,tmp)
    tmp = 0
    
print(max(ans,tmp))

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

Solution (Python):


def is_acgt_char(c):
  return c == "A" or c == "C" or c == "G" or c == "T"

def main():
  S = input()
  ans = 0

  for i in range(len(S)):
    count = 0
    
    for j in range(i, len(S)):
      if(not is_acgt_char(S[j])):
        break

      count += 1

    ans = max(ans, count)

  print(ans)

if __name__ == "__main__":
  main()

Solution (Python):
import math

s=list(input())
cnt = ""
for i in range(len(s)):
    if s[i]=="A" or s[i]=="T" or s[i]=="G" or s[i]=="C":
        t = ""
        for j in range(len(s)-i):
            if s[i+j]=="A" or s[i+j]=="T" or s[i+j]=="G" or s[i+j]=="C":
                t += s[i+j]
            else:
                break
        if len(t) >= len(cnt):
            cnt = t
print(len(cnt))

Solution (Python):
s = input().strip()
n = len(s)

acum = [0] * (n + 1)
acgt = ['A', 'C', 'G', 'T']

for i in range(1, n + 1):
    if s[i - 1] in acgt:
        acum[i] = acum[i - 1] + 1
    else:
        acum[0] = 0

print(max(acum))