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














N = len(s)
ans = 0
for i in range(N):
    for j in range(i, N):
        
        if all('ACGT'.count(c) 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(c in ['A', 'G', 'C', 'T'] for c in s[i : j + 1]):
            ans = max(ans, j - i + 1)
print(ans)

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

Solution (Python):




from __future__ import division, print_function 

import sys
import os
from collections import Counter, deque, defaultdict
import itertools
import math
import io


"""Uncomment modules according to your need"""













if sys.version_info[0] < 3:
    input = raw_input
    range = xrange

    filter = itertools.ifilter
    map = itertools.imap
    zip = itertools.izip



"""value of mod"""
MOD = 998244353
mod = 10**9 + 7

"""Uncomment next 4 lines if doing huge recursion"""




def prepare_factorial(mod=mod):
    """ returns two lists, factorial and inverse factorial modulo argument by default 10**9 +7 """
    
    fact = [1]
    for i in range(1, 200005):
        fact.append((fact[-1] * i) % mod)

    ifact = [0] * 200005
    ifact[200004] = pow(fact[200004], mod - 2, mod)
    for i in range(200004, 0, -1):
        ifact[i - 1] = (i * ifact[i]) % mod

    return fact, ifact

def modinv(n, p):
    """ returns N inverse modulo p """
    return pow(n, p - 2, p)

def ncr(n, r,  fact, ifact):
    """ takes 4 arguments: n , r and factorial and inverse factorial lists"""
    t = (fact[n] * (ifact[r]*ifact[n-r]) % MOD)% MOD
    return t


def get_n(Sum):    
    """this function returns the maximum n for which Summation(n) <= Sum"""
    ans = (-1 + sqrt(1 + 8*Sum))//2
    return ans

def sieve(n):
    """ returns a list of prime numbers till n """
    if n < 2: return list()
    prime = [True for _ in range(n + 1)]
    p = 3
    while p * p <= n:
        if prime[p]:
            for i in range(p * 2, n + 1, p):
                prime[i] = False
        p += 2
    r = [2]
    for p in range(3, n + 1, 2):
        if prime[p]:
            r.append(p)
    return r



def divs(n, start=1):
    """ returns a list of all divisors till n """
    divisors = []
    for i in range(start, int(math.sqrt(n) + 1)):
        if n % i == 0:
            if n / i == i:
                divisors.append(i)
            else:
                divisors.extend([i, n // i])
    return divisors



def divn(n, primes):
    """ returns the number of divisors, two arguments n and the sieve till n """
    divs_number = 1
    for i in primes:
        if n == 1:
            return divs_number
        t = 1
        while n % i == 0:
            t += 1
            n //= i
        divs_number *= t



def lrfind(d, x, default=-1):
    """ Takes 2 arguments an iterable and an element. returns a tuple (firstoccurence,lastoccurence) -1 if not found """
    left = right = -1
    for i in range(len(d)):
        if d[i] == x:
            if left == -1: left = i
            right = i
    if left == -1:
        return default, default
    else:
        return left, right

def gcd(x, y): 
    """ returns greatest common divisor of x and y """
    while y:
        x, y = y, x % y
    return x

def check_sorted(a):
    ''' returns True/False '''
    for i in range(len(a)-1):
        if a[i]>a[i+1]:
            return False
    return True
def ceil(n, k=1): return n // k + (n % k != 0) 
def input(): return sys.stdin.readline().strip()
def ii(): return int(input()) 
def mi(): return map(int, input().split()) 
def li(): return list(map(int, input().split())) 
def lw(): return input().split() 
def lcm(a, b): return abs(a * b) // gcd(a, b) 
def prr(a, sep=' ', end='\n'): print(sep.join(map(str, a)), end=end) 
def dd(): return defaultdict(int) 
def ddl(): return defaultdict(list) 
def write(s): return sys.stdout.write(s)













def main():
    
    s=input()
    answer=0
    temp=0
    for i in s:
        if i=="A" or i=="T" or i=="G" or i=="C":
            temp+=1
        else:
            answer=max(temp,answer)
            temp=0
    answer=max(temp,answer)
    print(answer)


















    
""" -------- Python 2 and 3 footer by Pajenegod and c1729 ---------"""

py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip
    range = xrange

import os, sys
from io import IOBase, BytesIO

BUFSIZE = 8192

class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill(): pass
        return super(FastIO, self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill();
            self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)


class IOWrapper(IOBase):

    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s: self.buffer.write(s.encode('ascii'))
            self.read = lambda: self.buffer.read().decode('ascii')
            self.readline = lambda: self.buffer.readline().decode('ascii')


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')



""" main function"""

if __name__ == '__main__':
    main()

Solution (Python):
s = input()

d = len(s)
ans = [0] * 10
tmp = 0
for i in range(d):
    if s[i] in "ACGT":
        ans[tmp] += 1
    else:
        tmp += 1
print(max(ans))

Solution (Python):
s = input()

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

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

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

Solution (Python):
S = input()

N = len(S)
ans = 0
for i in range(N):
  for j in range(i, N):
    is_ACGT = True
    for k in range(i, j+1):
      if S[k] not in ['A', 'C', 'G', 'T']:
        is_ACGT = False
        break
    if is_ACGT:
      ans = max(ans, j-i+1)

print(ans)

Solution (Python):
s=list(input())
n=len(s)
ans=[]
if n==1:
  if s.pop() in list('ATCG'):
    print(1)
    exit()

for i in range(n-1):
  for j in range(i+1,n+1):
    part=set(s[i:j])
    flag=True
    for p in part:
      if p not in list('ATGC'):
        flag=False
        break
    if flag==True:
      ans.append(len(s[i:j]))

if ans:
  print(max(ans))
else:
  print(0)

Solution (Python):
def main():
    ans = []
    s = input()
    count = 0
    for i in s:
        if i in "ATGC":
            count += 1
        else:
            ans.append(count)
            count = 0
    ans.append(count)
    print(max(ans))
        
if __name__ == "__main__":
    main()

Solution (Python):
s = input()
m=[]
t = 0
for i in list(s):
  if i == 'A' or i == 'C' or i == 'G' or i == 'T':
     t += 1
  else:
     t = 0
  m.append(t)

print(max(m))

Solution (Python):
S = input()

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

ans = 0
ok = False
tmp = 0
for s in S:
    if not ok:
        if s in acgt:
            ok = True
            tmp += 1
        else:
            pass
    elif ok:
        if s in acgt:
            tmp += 1
        else:
            ok = False
            ans = max(tmp,ans)
            tmp = 0
ans = max(tmp,ans)
print(ans)

Solution (Python):
s = input()

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

print(res)

Solution (Python):
s=input()
n=len(s)
 
res=0
for i in range(n):
  for j in range(i,n):
    sub=s[i:j+1]
    flg=True
    for k in sub:
      if(k not in ['A','G','C','T']):
        flg=False
    if(flg):
      res=max(res,len(sub))
      
print(res)

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

print(maxcount)

Solution (Python):
from sys import stdin

matches = ['A','C','G','T']
S = stdin.readline().rstrip()
cnt_row = 0
cnt_max = 0
for s in S:
    if s in matches:
        cnt_row += 1
        if cnt_max < cnt_row:
            cnt_max = cnt_row
    else:
        cnt_row = 0
print(cnt_max)

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

Solution (Python):
def checks(a):
  if a=="C" or a=="T" or a=="G"or a=="A":
    return True
  else:
    return False
s=str(input())
cnt=0
ans=0
for a in s:
  if checks(a):
    cnt+=1
    ans=max(cnt, ans)
  else:
    cnt=0
print(ans)

Solution (Python):
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readline_s = sys.stdin.readline
readlines = sys.stdin.buffer.readlines


def main():

    S = input()

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


if __name__ == '__main__':
    main()

Solution (Python):
import sys
from itertools import combinations
import math


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 a in s:
    if a in 'ACGT':
        temp += 1
    else:
        temp = 0
    ans = max(ans, temp)
print(ans)

Solution (Python):

s = input()
s = s.replace('G', 'A')
s = s.replace('T', 'A')
s = s.replace('C', 'A')


def long_repeat(line):
    cnt = 1
    max = 1
    if line != "":
        for i in range(1, len(line)):
            if line[i] == line[i-1]:
                cnt += 1
                if cnt > max:
                    max = cnt
            else:
                cnt = 1
        return max
    else:
        return 0


if 'A' not in s:
    print(0)
    exit()

print(long_repeat(s))

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

max_len = 0

for i in range(len(S)):
    for j in range(i, len(S)):
        if S[i:j+1][-1] not in ["A", "C", "G", "T"]:
            break
        else:
            max_len = max(max_len, len(S[i:j+1]))
            
print(max_len)

Solution (Python):
S = list(input())
P = set(["A","C","T","G"])
count = 0
if P&set(S) == set():
  print(0)
  exit()
else:
  for i in range(0,len(S)):
    for j in range(i+1, len(S)+1):
      if set(S[i:j])-P == set():
        count = max(count,j-i)
        
print(count)

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

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

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

if ans < temp:
    ans = temp

print(ans)

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

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

print(ans)

Solution (Python):
S=input()

ans=0
temp=0
l=['A','C','G','T']

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

print(ans)

Solution (Python):
S = input()
ACGT = ["A", "C", "G", "T"]
s = ""
l = []

for i in S:
    if i in ACGT:
        s += i
        l.append(s)
    else:
        l.append(s)
        s = ""

l2 = map(len, l)
print(max(l2))

Solution (Python):
S = list(input())
F = ["A", "C", "G", "T"]
count = 0
max = 0
f = 0
for i in S:
    for j in F:
        if j == i:
            count += 1
    if max < count:

        max = count
    else:
        count = 0
        if max != 0:
            f = max
        max = 0
    
print(max if max > f else f)

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

Solution (Python):
import re

s = input()

max_len = 0
for i in range(len(s)):
    for j in range(i, len(s)):
        a = s[i:j + 1]
        if re.fullmatch(r'(A|C|G|T)*', a):
            
            max_len = max(max_len, len(a))

print(max_len)

Solution (Python):


s = input()
ans = 0

for i in range(len(s)+1):
    for j in range(i):
        _s = s[j:i]
        _l = len(_s)
        for k in range(_l):
            if _s[k] not in "ACGT":
                break
        else:
            if(ans < _l):
                ans = _l

print(ans)

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

Solution (Python):
import copy

n = input()
m = copy.copy(n)
ans = 0

for x in range(len(n)):
    for l in range(len(n)):
            mm = m[x:len(n)-l]
            if mm.count("A") + mm.count("C") + mm.count("G")+ mm.count("T") == len(mm):
                ans = max(ans, len(mm))

print(ans)

Solution (Python):
s = input()
t = [0]*len(s)

for i in range(len(s)):
    if s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T':
        t[i] = 1

ans = []
tmp = 0
for j in t:
    if j == 1:
        tmp += 1
    else:
       ans.append(tmp)
       tmp = 0
ans.append(tmp)

print(max(ans))

Solution (Python):
S = input()

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

print(ans)

Solution (Python):
def actual(s):
    is_agct = lambda string: set(string).issubset({'A', 'G', 'C', 'T'})

    N = len(s)

    answer = 0

    for i in range(N):
        for j in range(N):
            substr = s[i:j + 1]  

            if is_agct(substr):
                answer = max(answer, len(substr))

    return answer


s = input()
print(actual(s))

Solution (Python):
def generate_substrings(s):
    N = len(s)

    if N == 0:
        return {''}

    if N == 1:
        return {'', s}

    substrings = set()

    for i in range(N):
        for j in range(1, N + 1):
            substrings.add(s[i:j])

    return substrings


def actual(s):
    sub_strings = generate_substrings(s)
    is_agct = lambda string: set(string).issubset({'A', 'G', 'C', 'T'})

    agct_length_list = [len(s) for s in sub_strings if is_agct(s)]

    return max(agct_length_list)

s = input()
print(actual(s))

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

    cnt = 0
    cntmax = 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:
            cntmax = max(cntmax, cnt)
            cnt = 0

    print(cntmax)
resolve()

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

cnt = 0
ans = [0]

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

Solution (Python):
import re
S = input()

result = re.findall(r'[ACGT]*',S)

ans = 0
for r in result:
    if ans < len(r):
        ans = len(r)
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(l) for l in s[i:j + 1]):
            ans = max(ans, j - i + 1)

print(ans)

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

flag = 0
for i in reversed(range(0,n+1)):
  for j in range(0,n-i+1):
    s = S[j:j+i].replace("A", "").replace("C", "").replace("G","").replace("T","")
    
    if len(s) == 0:
      flag=1
      break
  if flag==1:
    break

print(i)

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

for i in s:
    if i == 'A' or i == 'C' or i == 'G' or i == 'T':
        arr.append(1)
    else:
        arr.append(0)

for i in range(0, len(arr)):
    if arr[i] == 0:
        count = 0
    else:
        count += 1
        ans = max(ans, count)
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':
        j = i
        cnt = 0
        while j < len(s) and (s[j] == 'A' or s[j] == 'C' or s[j] == 'G' or s[j] == 'T'):
            cnt += 1
            j += 1
        max_cnt = max(max_cnt, cnt)

print(max_cnt)

Solution (Python):
def readinput():
    s=input()
    return s

def main(s):
    
    maxlen=0
    for i in range(len(s)):
        for j in range(i+1, len(s)+1):
            sub=s[i:j]
            for c in sub:
                if(c == 'A' or c == 'C' or c == 'G' or c == 'T'):
                    pass
                else:
                    break
            else:
                maxlen=max(maxlen,len(sub))
        
    return maxlen

if __name__=='__main__':
    s=readinput()
    ans=main(s)
    print(ans)

Solution (Python):
s = str(input())
count = 0
m = 0
for i in s:
    if i in "A":
        count += 1
    elif i in "C":
        count += 1
    elif i in "G":
        count += 1
    elif i in "T":
        count += 1
    else:
        count = 0
    m = max(m, count)
print(m)

Solution (Python):
def readinput():
    s=input()
    return s

def main(s):
    
    maxlen=0
    templen=0
    for i in range(len(s)):
        if(s[i]=='A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T'):
            templen+=1
        else:
            maxlen=max(maxlen,templen)
            templen=0
        
    return max(maxlen,templen)

if __name__=='__main__':
    s=readinput()
    ans=main(s)
    print(ans)

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

Solution (Python):
s=input()
lis=[]
for i in range(0,len(s)):
    for j in range(min(i+1,len(s)-1),len(s)+1):
        lis.append(s[i:j])
res=0

for i in lis:
    if i.count("A") + i.count("C") + i.count("G") + i.count("T") == len(i):
        res=max(res,len(i))
print(res)

Solution (Python):
import re

S = str(input())

sub = re.findall(r'[ACGT]*', S)
sub = [len(i) for i in sub]
print(max(sub))

Solution (Python):
S = input()

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

ans = max(res, ans)
print(ans)

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

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


ans_list=[]
for i in range(len(s)):
    ans = 0
    if hoge(s[i]):
        ans+=1
        for j in range(i+1,len(s)):
            if hoge(s[j]):
                ans+=1
            else:
                ans_list.append(ans)
                break
    ans_list.append(ans)
print(max(ans_list))

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

count = 0
record = 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:
        if count > record:
            record = count
        count = 0
if count>record:
    record = count

print(record)

Solution (Python):
import re

S = input()
L = re.findall("[AGCT]+", S)
LL = [len(x) for x in L ]
if LL:
    print(max(LL))
else:
    print(0)

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

Solution (Python):
S=str(input())
lst=['A','C','G','T']
ans=0

for i in range(len(S)):
    cnt=0
    if S[i] in lst:
        cnt+=1
        if i==len(S)-1:
            ans = max(ans,cnt)
            break
        while S[i+1] in lst:
            cnt+=1
            i+=1
            if i+1==len(S):
                break
    ans=max(ans,cnt)

print(ans)

Solution (Python):
import sys
import itertools
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
S = read().decode('utf-8')
count=0
cnt_max=0
for i in range(len(S)):
  if S[i] in ['A', 'C', 'G', 'T']:
    count +=1
  else:
    cnt_max = max(cnt_max,count)
    count=0
print(cnt_max)

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

Solution (Python):
s=input()
mx=0
for i in range(len(s)):
  a=s[:len(s)-i]
  for j in range(len(s)-i):
    b=a[j:]
    if b.count('A')+b.count('C')+b.count('G')+b.count('T')==len(b):
      mx=max(mx,len(b))
print(mx)

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

Solution (Python):
s = input()
maxl = 0
l = 0
for i in range(len(s)):
  if s[i] in 'ACGT':
    l += 1
  else:
    if maxl < l:
      maxl = l
    l = 0
if maxl < l:
  maxl = l
print(maxl)

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

Solution (Python):
S=input()

lis=[]
for x in range(len(S)):
	alt=len(S)-x
	for y in range(alt):
		y=len(S)-y
		ts=S[x:y]
		ca=ts.count('A')
		cg=ts.count('G')
		cc=ts.count('C')
		ct=ts.count('T')

		if len(ts)==ca+cg+cc+ct:
			lis.append(len(ts))
if lis !=[]:
	print(max(lis))
else:
	print(0)

Solution (Python):
import re
s = input()


result = re.findall('[ACGT]*', s)
ans = max(map(len,result))
print(ans)

Solution (Python):

import re
print(max(map(len,re.findall("[ACGT]*",input()))))

Solution (Python):
from re import findall

s = input()
res = findall('[ACGT]*', s)
max_len = max(map(len, res))
print(max_len)

Solution (Python):

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

if __name__=='__main__':
    main()

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

Solution (Python):
input = input()
num = 0
max = 0
for j in range(len(input)):
    i = input[j]
    if i == "A" or i == "T" or i == "C" or i == "G":
        num += 1
        max = num if num > max else max
    else: 
        num = 0
print(max)

Solution (Python):
s=input()
def che(s):
  for c in s:
    if c=='A' or c=='C' or c=='G' or c=='T':
      pass
    else:
      return 0
  return 1
mx=""
for i in range(0,len(s)+1):
  for j in range(0, len(s)+1):
    com=s[i:j]
    if len(com)==0:
      continue
    if len(mx)<len(com) and che(com):
      mx=com
print(len(mx))

Solution (Python):


s=input()

maxl=0
a="ACGT"
for i in range(len(s)):
    cntl=0
    if s[i] in a:
        cntl+=1
        for j in range(i+1,len(s)):
            if s[j] in a:
                cntl+=1
            else:
                break
    i+=cntl
    maxl=max(maxl,cntl)

print(maxl)

Solution (Python):
s = input()
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=str(input())
s=s.replace('A', '1').replace('T', '1').replace("C", "1").replace("G", "1")
l=len(s)
d=0
for i in range(l):
  for k in range(i, l+1):
    if s[i:k].count("1")==len(s[i:k]):
      d=max(d, len(s[i:k]))
print(d)

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

Solution (Python):
s = input()
ans = 0
g = 0
for i in range(len(s)):
    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
        g += 1
        if g > ans:
            ans = g
    else:
        g = 0;
print(ans)

Solution (Python):
import re
s = input()
len_s = len(s)
max_ACGT = 0

for i in range(len_s):
    for j in range(i + 1, len_s+1):
        partial_s = s[i:j]
        if len(re.findall('A|C|G|T', partial_s)) == len(partial_s) and len(partial_s) > max_ACGT:
            max_ACGT = len(partial_s)

print(max_ACGT)

Solution (Python):
s=input()

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

print(ans)

Solution (Python):
def main():
    S = input()
    string = 'ACGT'
    current = 0
    ans = 0
    i = 0
    while i <= (len(S)-1):
        if S[i] in string:
            current = 1
            j = i+1
            while j<len(S) and S[j] in string:
                j = j+1
                current = current+1
            if current>ans:
                ans = current
        i = i+1
    print(ans)
main()

Solution (Python):
S=input()
n=len(S)
ans=0

no=False
for i in range(n):
    for j in range(i,n):
        for k in range(i,j+1):
            if not S[k] in ("A","C","G","T"):
                no=True
                break
        if no:
            no=False
            break
        ans=max(ans,j-i+1)
print(ans)

Solution (Python):
S=input()

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

Solution (Python):
import sys

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

Solution (Python):

S = input()
count_max = 0
count = 0
for i in range(len(S)):
    if "A" in S[i] or "C" in S[i] or"G" in S[i] or"T" in S[i]:
        count += 1
    
        if i+1 == len(S) and count>count_max:
            count_max = count
    
    elif count > count_max:
            count_max = count
            count = 0
print(count_max)

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

Solution (Python):
s = input()

ans = 0
n = 0
for i in range(len(s)):
    if s[i] == 'A' or s[i] == 'T' or s[i] == 'C' or s[i] == 'G':
        n += 1
        if ans < n:
            ans = n
    else:
        n = 0

print (ans)

Solution (Python):
s = input()
l = len(s)
atgc = {'A', 'T', 'G', 'C'}

ans = 0
for i in range(l+1):
    for j in range(i+1, l+1):
        for k in s[i:j]:
            if k not in atgc:
                break
        else:
            ans = max(ans, j-i)
print(ans)

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

Solution (Python):
S = input()

_max = 0
count = 0

for c in S:
    if c in 'ATGC':
        count += 1
    else:
        _max = max(_max, count)
        count = 0
else:
    _max = max(_max, count)
    
print(_max)

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

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

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

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

Solution (Python):
ln = input()
output = ''
a = ''
for i in ln:
    if i == 'A' or i == 'T' or i == 'C' or i == 'G' :
        a += i
    else:
        if len(output) < len(a):
            output = a
        a = ''
if len(output) < len(a):
        output = a
a = ''        
print(len(output))

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