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()
ans = 0

def check(sub):
    check_s = set(list("ACGT"))
    for c in sub:
        if not c in check_s:
            return 0
    return len(sub)    
    
for i in range(len(s)):
    for j in range(i+1, len(s)+1):
        ans = max(ans, check(s[i:j]))

print(ans)

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

Solution (Python):

import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def roundUp(a, b):
        return -(-a // b)

    @staticmethod
    def toUpperMultiple(a, x):
        return Math.roundUp(a, x) * x

    @staticmethod
    def toLowerMultiple(a, x):
        return (a // x) * x

    @staticmethod
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

    @staticmethod
    def sign(n):
        if n == 0:
            return 0
        if n < 0:
            return -1
        return 1

    @staticmethod
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True

    @staticmethod
    def divisor(n):
        i = 1
        table = []
        while i * i <= n:
            if n % i == 0:
                table.append(i)
                table.append(n // i)
            i += 1
        table = list(set(table))
        return table


class PriorityQueue:
    def __init__(self, l=[]):
        self.__q = l
        heapq.heapify(self.__q)
        return

    def push(self, n):
        heapq.heappush(self.__q, n)
        return

    def pop(self):
        return heapq.heappop(self.__q)

    def list(self):
        return self.__q

    def length(self):
        return len(self.__q)


sys.setrecursionlimit(1000000)
MOD = int(1e09) + 7
INF = int(1e30)


def main():
    
    S = Scanner.string()
    ans = 0
    N = len(S)
    for i in range(N):
        for j in range(i, N):
            cnt = 0
            for s in S[i:j+1]:
                if not (s == "A" or s == "G" or s == "C" or s == "T"):
                    cnt = -1
                    break
                cnt += 1
            ans = max(ans, cnt)
    print(ans)
    return


if __name__ == "__main__":
    main()

Solution (Python):
S = input()

p = ['A','G','C','T']
flag = 1
num = 0
max_len = 0

for s in S:
    if s in p:
        num+=1
        if num>max_len:
            max_len= num
    else:
        flag =0
        num = 0
print(max_len)

Solution (Python):
s = list(input())
ACGT = ['A', 'C', 'G', 'T']

count = 0
result = []
for w in s:
    if w in ACGT:
        count += 1
    else:
        result.append(count)
        count = 0
result.append(count)

print(max(result))

Solution (Python):
import sys
input = sys.stdin.readline

S = input().strip()
a = ['A', 'T', 'G', 'C']

ans = 0
j = []
for i in range(len(S)):
  j = i
  count = 0
  while True:
    ans = max(ans, count)
    if j >= len(S):
      break
    if S[j] in a:
      count += 1
      j += 1
    else:
      break
  
print(ans)

Solution (Python):
text = list(input())
atcoder_char = ['A', 'C', 'G', 'T']
for i, char in enumerate(text):
    if char not in atcoder_char:
        text[i] = ''

max_count = 0
count = 0
for char in text:
    if char in atcoder_char:
        count += 1
    else:
        if max_count < count:
            max_count = count
            count = 0

print(max_count) if max_count >= count else print(count)

Solution (Python):
import re

S = input()

m = re.findall(r"[ACGT]+", S)
if m:
    print(max(map(len, m)))
else:
    print(0)

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):
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7

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

Solution (Python):
S = input()
ans = ''
t = ''
acgt = 'ACGT'
for s in S:
    if (s in acgt):
        t += s
    else:
        if (len(ans) < len(t)):
            ans = t
        t = ''

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

Solution (Python):
s = input()
acgt = ["A","C","G","T"]
res = []
parts = ""

for i in range(len(s)):
    parts = ""
    for c in s[i:]:
        if c in acgt:
            parts += c
        else:
            break
    res.append(len(parts))

print(max(res))

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

maxc = 0
c = 0

for i in range(N):
    if S[i] in {'A', 'T', 'G', 'C'}:
        c += 1
    else:
        maxc = max(maxc, c)
        c = 0
maxc = max(maxc, c)

print(maxc)

Solution (Python):
S = input()

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

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

print(ans)

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

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

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

Solution (Python):
s = input()

acgt = ['A', 'C', 'G', 'T']
ans = 0
char_cnt = 0
for c in s:
    if c in acgt: char_cnt += 1
    else: char_cnt = 0
    ans = max(ans, char_cnt)

print(ans)

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

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

ans = max(ans, tmp)

print(ans)

Solution (Python):
s = input()
N = len(s)
ans = 0
for i in range(N):
    v = 0
    for j in range(i, N):
        if not s[j] in {"A", "G", "C", "T"}:
            break
        v += 1
    ans = max(ans, v)
print(ans)

Solution (Python):


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

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

print(max(ans, tmp))

Solution (Python):
S = input()
for n in range(len(S),0,-1):
    for i in range(len(S)-n+1):
        s = S[i:i+n]
        for c in s:
            if c not in 'ACGT':
                break
        else:
            print(n)
            exit()
print(0)

Solution (Python):

s=input()
ans=0
cnt=0
acgt=["A","C","G","T"]
for i in range(len(s)):
    if s[i] not in acgt:
        if ans<cnt:
            ans=cnt
        cnt=0
    else:
        cnt+=1
print(max(ans,cnt))

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

Solution (Python):
S=input()
b=["A","T","G","C"]
cntl=[]
cnt=0
for i in S:
    if i in b:
        cnt+=1
    else:
        cntl.append(cnt)
        cnt=0
else:
    cntl.append(cnt)
print(max(cntl))

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

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

print(ans)

Solution (Python):

import sys


def solve(S: str):
    result = 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]):
                result = max(result, len(S[i : j + 1]))
    print(result)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    S = next(tokens)  
    solve(S)


if __name__ == "__main__":
    main()

Solution (Python):
s=input()
list_ = ["A","C","G","T"]
mn = 0
for i in range(len(s)):
    count = 0
    while True:
        if i >= len(s):
            break
        else:
            if not s[i] in list_ :
                break
            else :
                count += 1
                i += 1
    if mn < count:
        mn = count
print(mn)

Solution (Python):
def main():
    S = input()
    result = 0
    cnt = 0
    for s in S:
        if s in ['A', 'G', 'C', 'T']:
            cnt += 1
        else:
            cnt = 0
        if result < cnt: result = cnt
    print(result)


if __name__ == '__main__':
    main()

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

Solution (Python):
import sys
S = input()
ok = ["A","G","T","C"]
for l in range(len(S),0,-1):
  for i in range(0,len(S)-l+1):
    for s in S[i:i+l]:
      if s in ok:
        continue
      else:
        break
    else:
      print(l)
      sys.exit()
else:    
  print(0)

Solution (Python):
import sys

def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getlist():
    return list(map(int, input().split()))
import math
import heapq
from collections import defaultdict, Counter, deque
MOD = 10**9 + 7
INF = 10**15

def main():
    ans = 0
    s = input().strip()
    tmp = 0
    for c in s:
        if c in ["A", "C", "T", "G"]:
            tmp +=1
            ans = max(tmp, ans)
        else:
            tmp = 0
    print(ans)
if __name__ == '__main__':
    main()

"""
9999
3

2916
"""

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

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

cnt = 0
Ans = 0
for i in range(N):
    if S[i] == "A" or S[i] == "T" or S[i] == "G" or S[i] == "C":
        cnt += 1
        Ans = max(Ans, cnt)
    else:
        Ans = max(Ans, cnt)
        cnt = 0
print(Ans)

Solution (Python):
S = list(input())
N = len(S)
M = ["A","G" ,"C" ,"T"]

cnt = 0
Ans = 0
for i in range(N):
    if S[i] in M:
        cnt += 1
        Ans = max(Ans, cnt)
    else:
        Ans = max(Ans, cnt)
        cnt = 0
print(Ans)

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

Solution (Python):
S=list(input())
p=0;q=0
for i in range(len(S)):
  for j in range(i,len(S)):
    if S[j]=="A" or S[j]=="C" or  S[j]=="G" or S[j]=="T":
      q=q+1
      p=max(p,q)
      
    else:
      q=0
      break
  q=0
print(p)

Solution (Python):
s = input()
l = list("ATCG")
ans = []
su = 0
for i in s:
    if i in l:
        su += 1
    else:
        ans.append(su)
        su = 0
ans.append(su)
print(max(ans))

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

atcg=('A','C','G','T')
dp=[0]*(1+n)
for i in range(n):
  if s[i] in atcg:
    dp[i+1]=dp[i]+1
  else:
    dp[i+1]=0
print(max(dp))

Solution (Python):
S=input()

ans_lst=[0]*len(S)
l=['A','C','G','T']
if S[0] in l:
    ans_lst[0]=1

for i in range(1,len(S)):
    if S[i] in l:
        ans_lst[i]=ans_lst[i-1]+1

print(max(ans_lst))

Solution (Python):
S = input()
max_ctr = 0
ctr = 0

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

print(max_ctr)

Solution (Python):
s=input()
ans=''
lis=[]
for i in s:
    if i in 'ATGC':
        ans += i
        if i == s[-1]:
            lis.append(len(ans))
    else:
        lis.append(len(ans))
        ans=''

print((max(lis)))

Solution (Python):



import re
s = input()
ret = [len(s) for s in re.findall(r"[ACGT]+", s)]
if len(ret) > 0:
    print(max(ret))
else:
    print(0)

Solution (Python):
s = input()

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

Solution (Python):
s = list(str(input()))
a = ['A','T','G','C']
ans = 0
length = 0
for i in s:
    if i in a:
        length += 1
    else:
        ans = max(ans, length)
        length = 0

ans = max(ans, length)
print(ans)

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

Solution (Python):
s = [x for x in list(map(str, input()))]

ans = 0
acgt = 0

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

print(ans)

Solution (Python):
S = input()
def check(S): 
    if S in "ATGC":
        return True
    else:
        return False

ans =0
for i in range(len(S)):
    temp = 0
    while i<len(S) and check(S[i]):
        temp+=1
        i+=1
    ans = max(ans,temp)

print(ans)

Solution (Python):
S = input()
candidates = ['A', 'C', 'G', 'T']

ans = 0
now = 0
for s in S:
  if s in candidates:
    now += 1
  else:
    ans = max(ans, now)
    now = 0

ans = max(ans, now)
print(ans)

Solution (Python):




def main():
    S = input()
    result, count = 0, 0
    for s in S:
        if s in ('A', 'C', 'G', 'T'):
            count += 1
            result = max(result, count)
        else:
            count = 0
    print(result)


if __name__ == "__main__":
    main()

Solution (Python):
def main():
    s = input()

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

    count = 0
    tmp = 0

    for i in range(len(s)):
        if s[i] in ok_str:
            tmp += 1
        else:
            if count < tmp:
                count = tmp
            tmp = 0

    if count < tmp:
        count = tmp

    print(count)

if __name__ == '__main__':
    main()

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

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

Solution (Python):
def main():
    S=input()
    T=[]
    X=[]
    T_append=T.append
    X_append=X.append
    for i in range(0,len(S)):
        if S[i] in ['A','G','C','T']:
            T_append(1)
        else:
            T_append(0)
    for i in range(0,len(S)):
        if T[i]==0:
            X_append(i)
    m=0
    if X==[]:
        print(len(S))
    else:
        m=max(X[0],len(S)-X[len(X)-1]-1)
        if len(X)==1:
            print(m)
        else:
            for i in range(0,len(X)-1):
                x=X[i+1]-X[i]-1
                if x>m:
                    m=x
            print(m)

if __name__ == '__main__':
    main()

Solution (Python):
s=input()
n=len(s)
li=[]
for i in range(n):
  if s[i]=="A" or s[i]=="T" or s[i]=="C" or s[i]=="G":
    li.append(s[i])
  else:
    li.append("0")
t=""
for i in range(n):
  t+=li[i]
a = list(map(len,t.split("0")))
a.sort()
print(a[-1])

Solution (Python):
s = input()
most = 0
acgt = ["A", "C", "G", "T"]
point = 0
for i in range(len(s)):
    if s[i] in acgt:
        point += 1
    else:
        if point > most:
            most = point
        point = 0
if point > most:
    most = point
point = 0
print(most)

Solution (Python):
s = input()
t = ["A", "C", "G", "T"]
c = [0]
n = 0
for i in s:
    d = 0
    for j in t:
        if i == j:
            d = 1
            n += 1
    if d == 0:
        c.append(n)
        n = 0
c.append(n)
c.sort()
print(c[len(c) - 1])

Solution (Python):
S = input()

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

print(max(cnt, max_ans))

Solution (Python):
def solve(s):
    acgt = ['A','C','G','T']
    ans = 0
    c = 0

    for si in s:
        if si in acgt:
            c += 1
        else:
            ans = c if c>ans else ans
            c = 0
    ans = c if c>ans else ans
    return ans


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

Solution (Python):
f = []
for w in input():
    if w == "A" or w == "C" or w == "G" or w == "T":
        f += "1"
    else:
        f += " "
if "1" in f:
    acgt = [i for i in list("".join(f).split())]
    acgt.sort()
    print(len(acgt[-1]))
else:
    print(0)

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

Solution (Python):
s = input()
pos = -1
ans = ""
t = 0

for i in range(len(s)):
	if s[i] == "A" or s[i]== "C" or s[i] == "G" or s[i] == "T":
		pos = i
		for j in s[pos:]:
			if j == "A" or j == "C" or j == "G" or j == "T": 
				ans +=  j
			else:
				break

	if t < len(ans):
		t = len(ans)
	ans = ""

print(t)

Solution (Python):
s=list(input())
dp = [0]*(len(s)+1)
for i in range(len(s)):
    if s[i] in 'ACGT':
        dp[i] += 1
        dp[i+1] += dp[i]
    else:
        dp[i]=0
print(max(dp))

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

Solution (Python):
s=str(input())
cnt=0
ans=[0]

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

ans.append(cnt)
print(max(ans))

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

Solution (Python):
s=list(input())
a=["A","C","G","T"]
c=""
for x in s:
    if x in a:c+="o"
    else:c+="x"

if c.count("oooooooooo"):print(10)
elif c.count("ooooooooo"):print(9)
elif c.count("oooooooo"):print(8)
elif c.count("ooooooo"):print(7)
elif c.count("oooooo"):print(6)
elif c.count("ooooo"):print(5)
elif c.count("oooo"):print(4)
elif c.count("ooo"):print(3)
elif c.count("oo"):print(2)
elif c.count("o"):print(1)
else:print(0)

Solution (Python):
s = input()

acgt = ["A","C","G","T"]
tmp = 0
ans = 0
for x in list(s):
    if x in acgt:
        tmp += 1
    else:
        ans = max(ans,tmp)
        tmp = 0
    ans = max(ans, tmp)

print(ans)

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

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

Solution (Python):
s = input()

flag = False
count = 0
ans = 0
for i in range(len(s)):
  if s[i] in ['A', 'T', 'C', 'G']:
      count += 1
  else:
    if count > ans:
      ans = count
      count = 0

print(max(ans, count))

Solution (Python):
s = input()
ans = 0
cache = 0
for c in s:
    if c in ["A", "C", "G", "T"]:
        cache += 1
    else:
        if cache > ans:
            ans = cache
            cache = 0
if cache > ans:
    ans = cache
print(ans)

Solution (Python):
S = str(input())
ATGC = ['A', 'T', 'G', 'C']
 
ans = 0
last_ans = 0
for i in S:
  if i in ATGC:
    last_ans += 1
  else:
    ans = max(ans, last_ans)
    last_ans = 0
ans = max(ans, last_ans)
    
print(ans)

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

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

print(ans)

Solution (Python):
import re
S = input()
N = len(S)
result = re.findall(r'[ACGT]+', S)
if len(result) > 0:
    tmp = [len(x) for x in result]
    print(max(tmp))
else:
    print(0)

Solution (Python):
s = input()
cnt = 0
li = [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 i == len(s)-1:
      li.append(cnt)
  else:
    li.append(cnt)
    cnt = 0
print(max(li))

Solution (Python):
S=list(map(str,input()))
L=[0]*(len(S)+1)
for i in range(len(S)):
    if S[i] in "ACGT":
        L[i]+=1
        L[i+1]+=L[i]
print(max(L))

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

for i in range(len(s)):
    if(s[i] in "AGCT"):
        cnt += 1
        if(cnt > ans):
            ans = cnt
    else:
        cnt = 0
print(ans)

Solution (Python):
S = input()
S += 'Z'
count = 0
l = []
for s in S:
  if s not in ['A', 'T', 'C', 'G']:
    l.append(count)
    count = 0
  else:
    count += 1
l.sort()
print(l[-1])

Solution (Python):
s = list(str(input()))
a = ["A", "T", "G", "C"]
ans = 0
st = 0
for i in s:
    if i in a:
        st += 1
    else:
        ans = max(ans, st)
        st = 0

ans = max(ans, st)
print(ans)

Solution (Python):
s = input()

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

print(answer)

Solution (Python):
s = input()
acgt = {"A", "C", "G", "T"}
ans = 0
now = 0
for i in range(len(s)):
    if s[i] in acgt:
        now += 1
    else:
        now = 0
    ans = max(ans, now)
print(ans)

Solution (Python):
s=list(input())
d=["A","G","C","T"]
a=[]
b=[]
x=[]
for i in range(len(s)):
    a.append(s[i:])
for j in a:
    for k in range(len(j)-1):
        b.append(j[:-k-1])
ans=a+b
for i in ans:
    if set(i) <= set(d):
        x.append(len(i))
    else:
        pass
if x:
  print(max(x))
else:
  print(0)

Solution (Python):
s = input()

ts=""
for i in s:
  if i in "ATCG":
    ts+="1"
  else:
    ts+=","

ans=0
for i in ts.split(","):
  ans=max(ans, len(i))
print(ans)

Solution (Python):
import sys

INPUT = lambda: sys.stdin.readline().rstrip()

sys.setrecursionlimit(10 ** 9)


def main():
    S = INPUT()
    
    tmp = ""
    for s in S:
        tmp += str(1) if s in 'ACGT' else str(0)

    ans = 0
    for l in list(map(str, tmp.split("0"))):
        ans = len(l) if len(l) > ans else ans

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
S = list(input())
n = len(S)
ACGT = ["A","C","G","T"]
ans = 0
for i in range(n):
    if S[i] in ACGT:
        if i == n-1:
            ans = max(ans,1)
        else:
            streak = 1
            for j in range(i+1,n):
                if S[j] in ACGT:
                    streak += 1
                else:
                    break
            ans = max(ans,streak)

print(ans)

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

Solution (Python):
S = input()
table = [0] * (len(S) + 1)
for i in range(len(S)):
    if S[i] in set("ACGT"):
        table[i + 1] = table[i] + 1
print(max(table))

Solution (Python):
def main():
    str = input()

    max_len = 0
    len_acgt = 0
    for i in range(len(str)):
        if str[i] in "ACGT":
            len_acgt += 1
        else:
            len_acgt = 0

        max_len = max(max_len, len_acgt)

    print(max_len)


if __name__ == "__main__":
    main()

Solution (Python):
S = input()
m = 0
count = 0
for s in S:
    if s in 'ACGT':
        count += 1
    else:
        count = 0
    m = max(m, count)
print(m)

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

Solution (Python):

s=list(input())

c=["A","T","C","G"]
ans=0
i=0
while s:
    cnt=0
    if s[0] not in c:
        s.pop(0)
        continue
    while s[0] in c:
        s.pop(0)
        cnt+=1
        if s==[]:
            break
    if ans<cnt:
        ans=cnt
print(ans)

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

Solution (Python):
import re
S = input()
match = re.findall("[ACGT]*", S)
print(max(map(len, match)))

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

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

s.append(" ")

current = 0
ans = 0
for i in range(len(s)):
    if s[i] not in "ACGT":
        ans = max(ans, i-current)
        current = i+1

print(ans)

Solution (Python):
S = input()

ans = 0
for i in range(len(S)):
  for j in range(i, len(S)):
    T = S[i:j+1]
    if set(T) <= set("ACGT"):
      ans = max(ans, j-i+1)
print(ans)

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()
m=0
cnt=0
for i in s:
  if i in "ACGT":
    cnt += 1
  else:
    cnt = 0
  m=max(m,cnt)
print(m)

Solution (Python):
S=input()
max=0
flag=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"):
        flag=1
    else:
        flag=0

    if flag==1:
        count=count+1
    else:
        count=0

    if max<count:
        max=count
print(max)

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

Solution (Python):

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

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

Solution (Python):
S = input()

cnt = 0
results = []

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

Solution (Python):
import sys
import math
import itertools

b=input()
list=[]
count=0


for i in range(len(b)):
	if b[i]=="A" or b[i]=="G" or b[i]=="T" or b[i]=="C":
		count+=1
	else :
		count=0
	list.append(count)

print(max(list))

Solution (Python):
S = list(input())
ACGT = set(["A","C","G","T"])
ans = 0
acgt_length = 0

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

print(ans)

Solution (Python):
from itertools import groupby

S = list(input())
b = [i in list('ACGT') for i in S]

ans = 0
for i, j in groupby(b):
    num_elements = len(list(j))
    if i and num_elements > ans:
        ans = num_elements
print(ans)

Solution (Python):
gene = ["A","T","G","C"]

S = list(input())

ans = 0
tmp = 0

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

print(ans)

Solution (Python):
S = str(input())
m=0
point=0
for i in S:
    if i == "A" or i == "G" or i == "C" or i == "T":
        point+=1
    else:
        point*=0
    m = max(m, point)
print(m)

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

Solution (Python):
x = input()
i = 0
ans = 0
for xi in x:
  if xi == 'A' or xi == 'T' or xi == 'G' or xi == 'C':
    i = i + 1
  else:
    if ans < i:
      ans = i
    i = 0
if ans < i:
  ans = i
print(ans)

Solution (Python):
def read_values():
    return map(int, input().split())


def read_list():
    return list(read_values())


def main():
    S = input()
    res = 0
    tmp = 0
    for s in S:
        if s in ("A", "T", "C", "G"):
            tmp += 1
        else:
            res = max(res, tmp)
            tmp = 0
    res = max(res, tmp)
    print(res)


if __name__ == "__main__":
    main()

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=input()
H="AGTC"

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

Solution (Python):
s = input()
l = ["A", "C", "G", "T"]
count = 0
m = []

for i in range(len(s)):
  if s[i] in l:
    count += 1
  else:
    m.append(count)
    count = 0
m.append(count)
    
print(max(m))