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):
def checkACGT(s):
    ss = ''.join(s)
    check = ss.replace('A', '').replace('C', '')\
    .replace('G','').replace('T', '')
    if len(check) == 0:
        return True
    else:
        return False


s = input()
ans = 0
for i in range(len(s)):
    for j in range(len(s) - i + 1):
        ss = s[i:j + i]
        
        if (checkACGT(ss)):
            ans = max(ans, len(ss))
print(ans)

Solution (Python):
S = input()

ans = 0

for l in range(len(S)):
    for r in range(l, len(S)):
        T = S[l:r+1]
        if set(T) <= set('ACGT'):
            ans = max(ans, r-l+1)

print(ans)

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

Solution (Python):
import sys
lines = [s.rstrip("\n") for s in sys.stdin.readlines()]
input = lines.pop(0)
acgt = tuple("ACGT")
max_num_list = []
max_num = 0
for c in input:
    if c in acgt:
        max_num += 1
    else:
        max_num_list.append(max_num)
        max_num = 0
max_num_list.append(max_num)
print(max(max_num_list))

Solution (Python):
s = input()

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

max_ = 0
tmp = 0
for i in range( len(s) ):
    if s[i] in data:
        tmp += 1
        if tmp >= max_:
            max_ = tmp
    else:
        tmp = 0

print(max_)

Solution (Python):
S = input()
S += '*'
cnt = 0
ans = 0

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

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

count = 0
maximam = 0
for i in S:
    if i == 'A' or i == 'C' or i == 'G' or i == 'T':
        count += 1
    else :
        count = 0
    if count > maximam:
        maximam = count
print(maximam)

Solution (Python):


S = input()


ACGT = ["A", "C", "G", "T"]
ans = 0
N = len(S)
for i in range(N):
    for j in range(i, N):
        if all([S[k] in ACGT for k in range(i, j + 1)]):
            ans = max(ans, j - i + 1)


print(ans)

Solution (Python):

s = str(input())
acgt = ['A', 'C', 'G', 'T']

temp = 0
ans = 0

for i in range(len(s)):
    tar = s[i]
    if (tar in acgt):
        temp += 1
    else:
        temp = 0

    ans = max(ans, temp)

print(ans)

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

print(max(ans,temp))

Solution (Python):
S=list(input())
n=len(S)
ans=0
ansl=[0]
for i in range(n):
    if S[i]=="A" or S[i]=="C" or S[i]=="G" or S[i]=="T":
        ans+=1
    else:
        ans=0
    ansl.append(ans)
ansl.sort(key=int)
print(ansl[n])

Solution (Python):
S = input()
ans = 0
for i in range(len(S)):
    for j in range(len(S)-i):
        ACGT = True
        for k in range(len(S)-i-j):
            if S[i:len(S)-j][k] != 'A' and S[i:len(S)-j][k] != 'G' and S[i:len(S)-j][k] != 'C' and S[i:len(S)-j][k] != 'T':
                ACGT = False
                break
        if ACGT and len(S)-i-j > ans:
            ans = len(S)-i-j
print(ans)

Solution (Python):
gene = {'A', 'T', 'G', 'C'}
s = input().strip()     

cnt = 0; ans = 0
for w in s:
    if w in gene:
        cnt += 1
    else:
        ans = max(ans, cnt)
        cnt = 0
print(max(ans, cnt))

Solution (Python):
s = input()

not_ACGT_list = [-1]
max_len = 0

for i in range(len(s)):
    if s[i] != "A" and s[i] != "C" and s[i] != "G" and s[i] != "T":
        not_ACGT_list.append(i)
not_ACGT_list.append(len(s))

        
for i in range(len(not_ACGT_list)-1):
    max_len = max(max_len,not_ACGT_list[i+1]-not_ACGT_list[i]-1)

print(max_len)

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


from queue import Queue
from queue import LifoQueue as Stack
from math import sqrt, floor, ceil, log2, log10, pi
from fractions import gcd
from itertools import permutations, combinations
from operator import itemgetter
from functools import cmp_to_key


INF=1001001001
__MOD__=(10**9)+7
yn = 'YNeos'
judge = False
cnt = 0
ans = None


def lcm(a, b):
    return (a*b) // gcd(a,b)

def intinput():
    return int(input())

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

def lineinputs(func=intinput):
    datas = []
    while True:
        try:
            datas.append(func())
        except EOFError:
            break
    return datas

class ModInt():
    def __init__(self, x):
        self.__x = (x % __MOD__)
    def __add__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x + other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x + other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __radd__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((other.__x + self.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((other.__x + self.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")

    def __sub__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x - other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x - other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __rsub__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((other.__x - self.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((other.__x - self.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")

    def __mul__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x * other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x * other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __rmul__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((other.__x * self.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((other.__x * self.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")

    def __truediv__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x * other.__modinv())%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x * other.__modinv())%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __rtruediv__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((other.__x * self.__modinv())%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((other.__x * self.__modinv())%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")

    def __pow__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__(pow(self.__x, other.__x, __MOD__)))
        elif type(other) == ModInt:
            return self.__class__(pow(self.__x, other.__x, __MOD__))
        else:
            raise Exception("Not Int or Not ModInt")
    def __rpow__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__(pow(other.__x, self.__x, __MOD__)))
        elif type(other) == ModInt:
            return self.__class__(pow(other.__x, self.__x, __MOD__))
        else:
            raise Exception("Not Int or Not ModInt")

    def __modinv(self, m=__MOD__):
        a = self.__x
        if a == 0:
            raise ZeroDivisionError()
        if gcd(a, m) != 1:
            raise Exception("%sの逆数は求まりません。" % a)
        b, u, v = m, 1, 0
        while b != 0:
            t = a//b;
            a -= t*b
            a, b = b, a
            u -= t * v
            u, v = v, u
        u %= m
        if u < 0:
            u += m
        return u
    def __int__(self):
        return self.__x
    def __str__(self):
        return str(self.__x)



if __name__ == '__main__':
    S = input()
    acgt_set = set(['A', 'C', 'G', 'T'])
    i, last = 0, len(S)

    ans = 0
    while i < last:
        if S[i] not in acgt_set:
            i += 1
            continue
        j = i+1
        while j < last:
            if S[j] not in acgt_set:
                break
            j += 1
        ans = max(ans, j-i)
        i = j
    
    print(ans)

Solution (Python):
S = input()
N = len(S)
ans = [0]
x = 0

for i in range(N):
    s = S[i]
    if s == 'A' or s == 'C' or s == 'G' or s == 'T':
        x += 1
        if i == N -1:
            ans.append(x)
    
    else:
        if x != 0:
            ans.append(x)
        x = 0
    
print(max(ans))

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

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

Solution (Python):
import copy
import math


def get_int():
    return int(input())

def get_string():
    return input()

def get_int_list():
    return [int(x) for x in input().split()]

def get_string_list():
    return input().split()

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

def get_string_char_list():
    return list(str(input()))




'''
while (idx < n) and ():

    idx += 1
'''

def main():

    a_list = get_string_char_list()
    ans = 0
    count = 0
    for s in a_list:

        if s in ("A","C","G","T"):
            count += 1
            ans = max(ans, count)
        else:
            count = 0
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
S=input()
 
acgt_list=[0]
for i in range(len(S)):
  for j in range(i+1,len(S)+1):
    slen=len(S[i:j])
    temp=0
    for s in S[i:j] :
      if s=='A' or s=='C' or s=='G' or s== 'T':
        temp+=1      
    if temp==slen:
      acgt_list.append(slen)
      
print(max(acgt_list))

Solution (Python):
s = input()
t = ['A', 'C', 'G', 'T']
mx = 0
a = 0
for ss in s:
    if ss in t:
        a += 1
    else:
        mx = max(mx, a)
        a = 0
mx = max(mx, a)
print(mx)

Solution (Python):
def solve():
    S = input()
    N = len(S)
    max_length = 0

    for i in range(N):
        for j in range(N):
            if i+j >= N:
                break
            temp_str = S[i:N-j]
            temp_str = temp_str.replace("A", "")
            temp_str = temp_str.replace("C", "")
            temp_str = temp_str.replace("G", "")
            temp_str = temp_str.replace("T", "")
            if (len(S[i:N-j]) > 0 and temp_str == ""):
                if (len(S[i:N-j]) > max_length):
                    max_length = len(S[i:N-j])

    print(max_length)


if __name__ == "__main__":
    solve()

Solution (Python):
import sys
S = list(input())
X = ["A","C","G","T"]

max_len = 0
cur = 0

for i in S:
    if i in X: cur += 1
    else:
        if cur> max_len:
            max_len = 0
            max_len +=cur
            cur = 0
        else:
            cur = 0

if cur > max_len:
    print(cur)
    sys.exit()

print(max_len)

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

Solution (Python):
s=input()

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

Solution (Python):
s = input()
n = len(s)
ac = ["A","C","G","T"]
acgt = []
for i in range(n+1):
    for j in range(i+1,n+1):
        

        a = list(set(list(s[i:j])))
        for k in range(len(a)):
            if a[k] not in ac:
                break
        else:
            
            
            acgt += [len(s[i:j])]    

if acgt == []:
    acgt += [0]

print(max(acgt))

Solution (Python):
import math


def resolve():

    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)



if __name__ == "__main__":
    resolve()

Solution (Python):
S = input()

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

ans = ''
a = ''
for i in range(len(S)):
    if S[i] in base:
        a += S[i]
        if len(a) > len(ans):
            ans = a
    else:
        a = ''
print(len(ans))

Solution (Python):
s = list(input())
right = 0
ans = 0
for left in range(len(s)):
    while right < len(s) and s[right] in ["A", "C", "G", "T"]:
        right += 1
    ans = max(ans, right - left)
    right = left + 1
print(ans)

Solution (Python):
ok='AGCT'
s=list(input())
cnt=0
ans=0
for si in s:
  if si in ok:
    cnt+=1
  else:
    ans = max(ans,cnt)
    cnt=0
ans = max(ans,cnt)
print(ans)

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

maxLength = 0

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

if maxLength < count:
    maxLength = count

print(maxLength)

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

Solution (Python):
s = input()
acgt = [0]
tmp = 0
for i in range(len(s)):
  if s[i] in ['A', 'C', 'G', 'T']:
    tmp += 1
  elif tmp > 0:
    acgt.append(tmp)
    tmp = 0

acgt.append(tmp)

print(max(acgt))

Solution (Python):
from sys import stdin

s = stdin.readline().strip()

def is_acgt(ss):
  sset = set(ss)
  sset.discard('A')
  sset.discard('G')
  sset.discard('C')
  sset.discard('T')
  return len(sset) == 0

for i in range(1, len(s)+1)[::-1]:
  for j in range(len(s) - i + 1):
    ss = s[j:j+i]
    if is_acgt(ss):
      print(i)
      exit()
      
print(0)

Solution (Python):
S = input().strip()
L = len(S)
l = L
while True:
    l -= 1
    for i in range(L-l):
        if len(set(list(S[i:i+l+1]+"ATGC"))) == 4:
            print(len(S[i:i+l+1]))
            exit()

Solution (Python):
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

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

Solution (Python):
S = input()
ans = 0
count = 0
ACGT = ['A', 'C', 'G', 'T']
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]):
            ans = max(ans, j-i+1)
print(ans)

Solution (Python):
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

s = input()

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

ans = ""

for i in range(len(s)):
    t = ""
    for j in range(i, len(s)):
        if s[j] in acgt:
            t += s[j]
        else:
            break
        if len(t) > len(ans):
            ans = t

print(len(ans))

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

print(m)

Solution (Python):
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    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
    ans = max(ans, tmp)
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
s = input().strip()
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()

target = list('ACGT')

count_list = [0] * len(S)
for i in range(len(S)):
    if S[i] in target:
        count_list[i] = 1

max_length = 0
for start in range(len(S)):
    if count_list[start] == 0:
        continue
    for end in range(start, len(S)):
        if count_list[end] == 0:
            break

        max_length = max(sum(count_list[start : end+1]), max_length)

print(max_length)

Solution (Python):
S = input()

ACGT = ['A', 'C', 'G', 'T']
cntList = []
cnt = 0
cntList.append(cnt)
for s in S:
    if s in ACGT:
        cnt += 1
        cntList.append(cnt)
    else:
        cnt = 0
print(max(cntList))

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

Solution (Python):
import math
import collections
import fractions
import itertools
import functools
import operator

def solve():
    s = input()
    size = len(s)
    ans = 0
    for beg in range(size):
        for end in range(beg+1, size+1):
            if all('ACGT'.count(c) == 1 for c in s[beg:end]):
                ans = max(ans, end-beg)
    print(ans)
    return 0

if __name__ == "__main__":
    solve()

Solution (Python):
import sys
def LS2(): return list(sys.stdin.readline().rstrip())  

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

ans = max(ans,a)

print(ans)

Solution (Python):
n = input()
cnt = 0
ans = 0
for i in range(len(n)):
    if n[i] in "ACGT":
        cnt += 1
        if ans <= cnt:
            ans = cnt
    else:
        cnt = 0
print(ans)

Solution (Python):
'''     ░░█ ▄▀█ █   █▀ █░█ █▀█ █▀▀ █▀▀   █▀█ ▄▀█ █▀▄▀█  
        █▄█ █▀█ █   ▄█ █▀█ █▀▄ ██▄ ██▄   █▀▄ █▀█ █░▀░█     '''







import math;   from collections import *
import sys;    from functools import reduce
import time;   from itertools import groupby



def input()         : return sys.stdin.readline()
def get_ints()      : return map(int, input().strip().split())
def get_list()      : return list(get_ints())
def get_string()    : return list(input().strip().split())
def printxsp(*args) : return print(*args, end="")
def printsp(*args)  : return print(*args, end=" ")


DIRECTIONS = [(+0, +1), (+0, -1), (+1, +0), (+1, -1)] 
NEIGHBOURS = [(-1, -1), (-1, +0), (-1, +1), (+0, -1),\
              (+1, +1), (+1, +0), (+1, -1), (+0, +1)]


CAPS_ALPHABETS = {chr(i+ord('A')) : i for i in range(26)}
SMOL_ALPHABETS = {chr(i+ord('a')) : i for i in range(26)}
INF = float('inf')




s = input()
ans = temp = 0
target = "ATGC"
for i in s:
	if i in target:
		temp += 1
		ans = max(temp, ans)
	else:
		temp = 0
print(max(ans, temp))

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

Solution (Python):
s = input()

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

print(max_length)

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

Solution (Python):
import re
s=input()
n=len(s)
ans=0
for i in range(n):
  for j in range(n):
    S=s[i:j+1]
    
    m=re.fullmatch(r'[ATCG]+',S)
    
    if m!=None:
      ans=max(ans,len(S))
print(ans)

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

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

ans = 0

for i in range(n):
    k = 0
    l = 0
    while i + k < n:
        if s[i+k] == 'A' or s[i+k] == 'C' or s[i+k] == 'G' or s[i+k] == 'T':
            k += 1
            l += 1
        else:
            break
    ans = max(ans, l)

print(ans)

Solution (Python):
S = input()
ret = 0
for i in range(len(S)):
    for j in range(i, len(S)):
        f = True
        for k in S[i:j + 1]:
            if k not in ("ACGT"):
                f = False
                break
        if f:
            ret = max(ret, (j + 1) - i)
print(ret)

Solution (Python):



S = input()

t = [0]*len(S)

if S[0] in ["A","C","G","T"]:
    t[0] = 1

for i in range(1,len(S)):
    if S[i] in ["A","C","T","G"]:
        t[i] = t[i-1] + 1
    else:
        t[i] = 0

print(max(t))

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

S = readline().rstrip()

right = 0
ans = 0
for left in range(len(S)):
  while right + 1 < len(S) and S[right] in "ACGT":
    right += 1
    
  if right + 1 == len(S):
    if S[right] in "ACGT" and ans < right - left + 1:
      ans = right - left + 1
      break
  
  if ans < right - left:
    ans = right - left
    
  if right == left:
    right += 1
    
print(ans)

Solution (Python):
S = str(input())
N = len(S)
A = set(["A","C","T","G"])
Flag = True
ans = 0
ret = 0
for i in range(N):
  if S[i] in A:
    if Flag:
      ans += 1
    else:
      ans = 0
  else:
    ans = 0
  ret = max(ret,ans)
print(ret)

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

def main():
    s = input()
    cnt = 0
    trial = 0
    for i in s: 
        if i in "ACGT":
            trial += 1
        else:
            cnt = max(cnt, trial)
            trial = 0
    print(cnt)

if __name__=="__main__":
    main()

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

def main():
    s = input()
    len_s = len(s)
    cnt = 0
    for i in range(len_s):
        trial = 0
        for k in range(i,len_s):
            if s[k] in "ACGT":
                trial += 1
            else:
                cnt = max(cnt,trial)
                break
    print(cnt)

if __name__=="__main__":
    main()

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

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

Solution (Python):
Str = input()
atgc = ['A', 'T', 'G', 'C']
max_cnt = 0
cnt = 0
for s in Str:
    if s in atgc:
        cnt += 1
        if max_cnt < cnt:
            max_cnt = cnt
    else:
        cnt = 0
print(max_cnt)

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

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

ans = max(cnt, ans)

print(ans)

Solution (Python):
S = input()
res = 0
l = ['A', 'C', 'G', 'T']
for i in range(len(S)):
  sub = 0
  for j in range(i, len(S)):
    if S[j] in l:
      sub += 1
    else:
      break
  if sub > res: res = sub
print(res)

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

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

res = 0

t = 0

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

res = max(res, t)

print(res)

Solution (Python):
s = input()
res = 0


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

Solution (Python):
S = input()

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

Solution (Python):
li = list(input())
ans = 0
num = 0
for i in range(len(li)):
    if li[i] == 'A' or li[i] == 'G' or li[i] == 'C' or li[i] == 'T':
        num += 1
    else:
        if ans < num:
            ans = num
        num = 0
if ans == 0:
    ans = num
if ans < num:
    ans = num
print(ans)

Solution (Python):
s = input()

acgt = 'ACGT'
res = cnt = 0
for i in s:
    if i in acgt:
        cnt += 1
    else:
        res = max(cnt, res)
        cnt = 0
res = max(cnt, res)
print(res)

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

Solution (Python):
a=[0]
for i in input():
 if i in "ACGT":a+=[a[-1]+1]
 else:a+=[0]
print(max(a))

Solution (Python):
S = input()

max_len = 0
for i in range(10):
    for j in range(i, 10):
        s = S[i:j+1]
        for n, k in enumerate(s, 1):
            if k not in ['A', 'T', 'G', 'C']:
                break
            if n == len(s):
                max_len = max(max_len, len(s))
print(max_len)

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

Solution (Python):
s = input()
ans = 0
tmp = 0
acgt = ['A','C','G','T']

for i in range(len(s)):
    if s[i] in acgt:
        tmp += 1
        if tmp > ans:
            ans = tmp
    elif tmp >= ans:
        ans = tmp
        tmp = 0

print(ans)

Solution (Python):
n=[*'ACGT'];s=input();count,result=0,0
for i in range(len(s)):
  for j in range(i,len(s)):
    if s[j] not in n:
      break
    else:
      count+=1
  result=max(result,count)
  count=0
print(result)

Solution (Python):
lngs = input()

ACGT = ["A", "C", "G", "T"]
out_list = []
out_list_long = []


for lng in lngs:

    if lng in ACGT:
        out_list += lng
    else:
        if len(out_list) > len(out_list_long):
            out_list_long = []
            out_list_long = out_list
        out_list = []

if len(out_list) > len(out_list_long):
    out_list_long = []
    out_list_long = out_list

print(len(out_list_long))

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

print(ans)

Solution (Python):
import re

m = re.findall(r'[ATCG]+', input())
print(max([len(x) for x in m]) if m else '0')

Solution (Python):
import re

m = re.findall(r'[ATCG]+', input())
if m:
    print(max([len(x) for x in m]))
else:
    print('0')

Solution (Python):
S=input()
l=len(S)
ans=0
str='ACGT'
for i in range(l):
    for j in range(i,l):
        if all (str.count(x)==1 for x 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('ACGT'.count(c) == 1 for c in S[i : j + 1]):
            ans = max(ans, j - i + 1)

print(ans)

Solution (Python):
S = input()

ans = 0
for i in range(len(S)):
    for j in range(i, len(S)):
        sub_s = S[i:j+1]
        is_acgt = True
        for s in sub_s:
            if s == "A" or s == "C" or s == "G" or s == "T":
                continue
            else:
                is_acgt = False
        if is_acgt:
            ans = max(ans, len(sub_s))

print(ans)

Solution (Python):
acgt = list('ACGT')
s = input()
ans = 0
count = 0
for i in s:
    if i in acgt:
        count += 1
        ans = max(count, ans)
    else:
        count = 0
print(ans)

Solution (Python):
import re
S = input()
T = re.findall(r'[ATGC]*', S)
print(len(max(T, key=len)))

Solution (Python):
s = input()

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

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


def check(T, usable: set):
    for t in T:
        if t not in usable:
            return 0
    return len(T)


def main():
    S = input().rstrip("\n")
    usable = {"A", "C", "G", "T"}
    candidates = []
    for i in range(len(S)):
        for j in range(i, len(S)):
            T = S[i:j+1]
            res = check(T, usable)
            candidates.append(res)

    print(max(candidates))


if __name__ == "__main__":
    main()

Solution (Python):
S = input()

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

ans = max(ans, cnt)

print(ans)

Solution (Python):
S=input()

l=0
for i in range(len(S)):
  for j in range(i+1,len(S)+1):
    s = set(S[i:j])
    if s <= {'A','C','G','T'} and len(S[i:j])>l:
      l = len(S[i:j])
      
print(l)

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

Solution (Python):
def main():
    S = str(input())
    longest = 0
    if len(S) < 2:
        if S == 'A' or S == 'G' or S == 'C' or S == 'T':
            print(1)
            return
        else:
            print(0)
            return
    for i in range(len(S)):
        cnt = 0
        loop = 0
        t = 0
        while cnt == 0 and loop + i < len(S):
            if S[loop + i] == 'A' or S[loop + i] == 'G' or S[loop + i] == 'C' or S[loop + i] == 'T':
                t += 1
                if longest < t:
                    longest = t
                loop += 1
            else:
                cnt = 1
    print(longest)
main()

Solution (Python):
s = input()

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