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()
count = 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':
    count += 1
    if max < count:
      max = count
  else:
    count = 0
print(max)

Solution (Python):
N =list(str(input()))
l=['A','C','G','T']

ans=0
for i in range(len(N)):
    num=0
    for u in range(len(N)-i):
        
        if N[i+u] in l:
            num+=1
        else:
            break
    ans=max(ans,num)        
print(ans)

Solution (Python):
target = 'ACGT'
S = input()

answer = 0
for start in range(len(S)):
    if S[start] not in target:
        continue
    count = 0
    for end in range(start, len(S)):
        if S[end] not in target:
            break
        count += 1
    
    answer = max(answer, count)

print(answer)

Solution (Python):
target = 'ACGT'
S = input()

answer = 0
for start in range(len(S)):
    if S[start] not in target:
        continue
    count = 0
    for end in range(start, len(S)):
        if S[end] in target:
            count += 1
        else:
            break
    
    answer = max(answer, count)

print(answer)

Solution (Python):
s = input()
tmp = 0
max = 0
def check(i):
  if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
    return True
  else:
    return False
for i in range(len(s)):
  if check(i):
    tmp += 1
  else:
    tmp = 0
  if tmp > max:
    max = tmp
print(max)

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

resolve()

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

Solution (Python):

def main():
    S = input()

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


if __name__ == '__main__':
    main()

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

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

Solution (Python):

def main():
    S = input()

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


if __name__ == '__main__':
    main()

Solution (Python):

def main():
    S = input()

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


if __name__ == '__main__':
    main()

Solution (Python):
import sys
from collections import deque

import math

def S(): return sys.stdin.readline().rstrip()
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())

def solve():
    key = {"A","C","G","T"}
    mx = 0
    count = 0
    for item in s:
        if item in key:
            count += 1
        else:
            mx = max(mx,count)
            count = 0
    mx = max(mx,count)
    print(mx)
    return

if __name__=='__main__':
    s = S()
    solve()

Solution (Python):
s = list(input())
count = 0
list1 = []
for x in s:
  if x == 'A' or x == 'G' or x == 'T' or x == 'C':
    count = count + 1
  list1.append(count)
  if x != 'A' and x != 'G' and x != 'T' and x != 'C':
    count = 0
    

print(max(list1))

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

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

Solution (Python):
max_len = 0
tmp = 0

S = input()
acgt = {'A': 0, 'C': 0, 'G': 0, 'T': 0}

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

max_len = max(max_len, tmp)
print(max_len)

Solution (Python):
b=list(str(input()))
E={"A","C","G","T"}
count=0
ans=0
for moji in b:
	if moji in E:
		count+=1
	else:
		ans=max(ans,count)
		count=0
ans=max(ans,count)
print(ans)

Solution (Python):
s = input()
ans = 0
for i in range(len(s)):
    for j in range(i+1,len(s)+1):
        t = s[i:j]
        if (all(map(lambda x:x in ['A','C','G','T'],t))):
            ans = max(len(t),ans)
print(ans)

Solution (Python):
S=input()
ans=0
length=0
for c in S:
    if (c == 'A' or c == 'G' or c == 'C' or c == 'T'):
        length += 1
        if length > ans:
            ans = length
    else:
        length = 0

print(ans)

Solution (Python):
s = input()


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

Solution (Python):
s = input()

ans = 0
cnt = 0
for i in s:
    if i in 'ATCG':
        cnt += 1
    else:
        ans = max(ans, cnt)
        cnt = 0
print(max(ans, cnt))

Solution (Python):
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush

sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

S = input()

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

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

Solution (Python):
S = input()

S = list(S)

ls = len(S)
count = 0
ans = 0

for i in range(ls):
      if S[i] == 'A' or S[i] == 'T' or S[i] == 'G' or S[i] == 'C':
          count += 1
          if count >= ans:
              ans = count
      else:
          count = 0

print(ans)

Solution (Python):
S=input()
cnt=0
lis=[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
        lis.append(cnt)
    else:
        cnt=0
print(max(lis))

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

Solution (Python):
S = input()

c = 0
m = 0
acgt = ['A', 'C', 'G', 'T']
for s in S:
    if s in acgt:
        c += 1
        if c > m:
            m = c
    else:
        c = 0

print(m)

Solution (Python):
s=input()
ans=[0]
atgc=["A","T","G","C"]
for i in range(len(s)):
    for k in range(i,len(s)):
        check=s[i:k+1]
        complete=0
        for i in range(len(check)):
            if check[i] in atgc:
                complete+=1
        if complete==len(check):
            ans.append(len(check))
print(max(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,tmp=0,0
for s in S:
  if s in ['A','T','G','C']:
    tmp+=1
  else:
    ans=max(tmp,ans)
    tmp=0
print(max(ans,tmp))

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

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

max_length = 0
length = 0
for word in S:
    if word in acgt:
        length+=1
    else:
        if length!=0:
            if max_length<length:
                max_length=length
            length=0
if length!=0:
    if max_length<length:
        max_length=length
print(max_length)

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

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

print(max(map(len,strings)))

Solution (Python):
import sys
import numpy as np
import numba
from numba import jit

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

@jit
def main(s):
  ans = 0
  for j, i in enumerate(s):
    if i=='A' or i=='C' or i=='G' or i=='T':
      cnt = 1
      j += 1
      while s[j]=='A' or s[j]=='C' or s[j]=='G' or s[j]=='T':
        j += 1
        cnt += 1
      ans = max(ans, cnt)
  return ans
        
s = str(readline().split())
print(main(s))

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

Solution (Python):
l=input()

ans=0
num=0

for i in l:
  if i=="A" or i=="G" or i=="C" or i=="T":
    num+=1
  else:
    ans=max(num,ans)
    num=0
ans=max(ans,num)
    
print(ans)

Solution (Python):
S = input()
ACGT = ['A', 'C', 'G', 'T']
ans = [0] * len(S)

for i in range(len(S)):
    if S[i] in ACGT:
        cnt = 1
        for j in range(len(S) - i - 1):
            if S[i+j+1] in ACGT:
                cnt += 1
            else:
                ans[i] = cnt
                break
        ans[i] = cnt

print(max(ans))

Solution (Python):
import re;print(max(len(i)for i in re.split('[^ACTG]',input())))

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

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

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

Solution (Python):
from sys import stdin
ans=0
rans=0
c=0
check=True
S = input().rstrip()
def countans(s,rans,check):
  if (s=='A' or s=='C' ) or (s=='G'or s=='T'):
    rans+=1
  else:
    check=False
  return rans,check

for s in range(len(S)):
  rans=0
  check = True
  while True:
    if check:
      rans, check = countans(S[s],rans,check)
      if s>=len(S)-1:
        break
      s+=1
    else:
      break
  if ans<rans:
    ans =rans

print(ans)

Solution (Python):

import sys
from itertools import product,combinations,accumulate
from functools import reduce,lru_cache
import heapq

def vfunc(f): return lambda *lst, **kwargs: list(map(lambda *x:f(*x,**kwargs),*lst))

def list_t(l): return vfunc(lambda *args:args)(*l)

def rvfunc(f): return lambda *lst, **kwargs: list(map(lambda *x:rvfunc(f)(*x,**kwargs) if all(vfunc(lambda y:isinstance(y,list))(x)) else f(*x,**kwargs),*lst))

def reader():return vfunc(lambda l:l.split())(sys.stdin.readlines())

s = reader()[0][0]
score = [0]
for i in s:
    if i in 'ACGT':score.append(score[-1]+1)
    else:score.append(0)
print(max(score))

Solution (Python):



import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """ATCODER"""
        output = """3"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """HATAGAYA"""
        output = """5"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """SHINJUKU"""
        output = """0"""
        self.assertIO(input, output)


def resolve():
    S = input()

    ans = 0











    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") == len(S[i:j]):
                ans = max(ans, len(S[i:j]))
    print(ans)


if __name__ == "__main__":
    
    resolve()

Solution (Python):



import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """ATCODER"""
        output = """3"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """HATAGAYA"""
        output = """5"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """SHINJUKU"""
        output = """0"""
        self.assertIO(input, output)


def resolve():
    S = input()

    ans = 0
    for i in range(len(S)):
        t = 0
        if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
            t += 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":
                    t += 1
                else:
                    break
        ans = max(ans, t)

    print(ans)


if __name__ == "__main__":
    
    resolve()

Solution (Python):
import sys
input = sys.stdin.readline
S = list(input())[: -1]
res = 0
for l in range(len(S)):
  for r in range(l + 1, len(S) + 1):
    for i in range(l, r):
      if not S[i] in ["A", "T", "C", "G"]: break
    else: res = max(res, r - l)
print(res)

Solution (Python):
S = input()

max_num = 0

count = 0
for x in S:
    if x in 'ACGT':
        count += 1
    else:
        max_num = max(max_num, count)
        count = 0

print(max(max_num, count))

Solution (Python):
s=input()
n=len(s)
c,m=0,0
l='ACTG'
for i in range(n):
    if(s[i] in l):
        c+=1
        m=max(c,m)
    else:
        c=0
m=max(c,m)
print(m)

Solution (Python):
import itertools

S = list(input())
Idxs = list(itertools.combinations(range(len(S)), 2)) 

def ACGT(Word):
    for w in Word:
        if w not in ["A", "C", "G", "T"]:
            return 0
    return len(Word)

ans = 0

for s in S:
    if s in ["A", "C", "G", "T"]:
        ans = 1
        break

for idx in Idxs:
    tmp = S[idx[0]:idx[1]+1]
    ans = max(ans, ACGT(tmp))
    
print(ans)

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

ans = [0]
ans_ = 0
for s in S:
    if s == "A" or s == "C" or s == "G" or s == "T":
        ans_ += 1
    else:
        ans.append(ans_)
        ans_ = 0
ans.append(ans_)
print(max(ans))

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

Solution (Python):
ans = 0
c = 1
li = ["A","C","G","T"]
s = input()
lens = len(s)
for i in range(lens):
    for j in range(lens-(i)):
        a = s[j:j+i+1]
        for k in range(i+1):
            if a[k] not in li:
                c = 1
                break
            else:
                c = 0
                continue
        if c == 0:
            ans = i+1
        else:
            c = 1
print(ans)

Solution (Python):
S = input()
ans = 0
n = len(S)
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+1-i)
print(ans)

Solution (Python):
S = input().rstrip()
P = {"A", "C", "G", "T"}
cnt = 0
res = 0
for s in S:
    if s in P:
        cnt += 1
        res = max(cnt, res)
    else:
        cnt = 0
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 c in sub:
            if(c not in ['A', 'G', 'C', 'T']): flg = False

        if(flg): res = max(res, len(sub))

print(res)

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

Solution (Python):
S = input()

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


max_l = 0

for i in range(len(S)):
    l = 0
    for j in range(i, len(S)):
        if S[j] in acgt:
            l+=1
        else:
            break
    if l > max_l:
        max_l = l
print (max_l)

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    S = readline().strip()

    ACGT = 'ACGT'

    ans = 0
    for i in range(len(S)):
        for j in range(i + 1, len(S) + 1):
            if j - i < ans:
                continue
            ok = True
            for c in S[i:j]:
                if c not in ACGT:
                    ok = False
                    break
            if ok and ans < j - i:
                ans = j - i

    print(ans)
    return


if __name__ == '__main__':
    main()

Solution (Python):
s = input()
cnt, res = 0, 0
for i in s:
	if i in 'ATGC':
		cnt += 1
		res = max(cnt, res)
	else:
		cnt = 0
print(res)

Solution (Python):
import sys
S = input()
maxer = 0
count = 0
for i in range( len(S) ):
    if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
        count += 1
        if maxer < count:
            maxer = count
    else:
        count = 0
print( maxer )

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

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

Solution (Python):
s = input()
t = "BDEFHIJKLMNOPQRSUVWXYZ"
res = ""
for x in s:
    if x in t:
        res += "0"
    else:
        res += x
ans = 0
for a in res.split("0"):
    ans = max(ans, len(a))
print(ans)

Solution (Python):
s = input()
ans = 0
start = 0
end = 1

def acgt(s):
    count = 0
    for i in ["A","T","G","C"]:
        count += s.count(i)
    return count

while start < len(s):
    check = s[start:end]
    while len(check) == acgt(check) and end <= len(s):
        end += 1
        check = s[start:end]
    lenth = end - start -1
    ans = max(ans, lenth)
    start = end
print(ans)

Solution (Python):




s = list(input())


def isACGT(s):
    A = s.count('A')
    C = s.count('C')
    G = s.count('G')
    T = s.count('T')
    if A+C+G+T == len(s):
        return True
    else:
        return False


ans = 0
n = len(s)
for i in range(n):
    for j in range(i, n):
        tempstring = s[i:j+1]
        if isACGT(tempstring):
            ans = max(ans, len(tempstring))
print(ans)

Solution (Python):
S=input()
agct='AGCT'
ans=0
for i in range(len(S)):
  cnt=0
  j=i
  while j<len(S) and S[j] in agct :
    cnt+=1
    j+=1
  ans=max(ans,cnt)
print(ans)

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

for i in range(L):
    for j in range(i, L):
        sub_S = S[i:j+1]
        if all([s in ACGT for s in sub_S]):
            if len(sub_S) > ans:
                ans = len(sub_S)

print(ans)

Solution (Python):
S = input()

max_cnt = 0
for i in range(len(S)):
    cnt = 0
    if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
        cnt += 1
        for j in range(len(S)-(1+i)):
            if S[j+i+1] == "A" or S[j+i+1] == "C" or S[j+i+1] == "G" or S[j+i+1] == "T":
                cnt += 1
            else:
                break
    if cnt >= max_cnt:
        max_cnt = cnt
print(max_cnt)

Solution (Python):
s = str(input())
w = ""
l = []
for i in s:
    if i=='A' or i=='C' or i=='G' or i=='T':
        w += i
    else:
        l.append(len(w))
        w = ""
l.append(len(w))
print(max(l))

Solution (Python):
def main():
    S = input()
    ans = 0
    cnt = 0
    flag = False

    for i in range(len(S)):
        if S[i] in "ACGT":
            flag = True
            cnt += 1

        if S[i] not in "ACGT" or i == len(S) - 1:
            flag = False

        if flag == False and cnt > ans:
            ans = cnt
            cnt = 0

    print(ans)


if __name__ == "__main__":
    main()

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

    for i in range(len(S)):
        if S[i] in "ACGT":
            cnt += 1

        if S[i] not in "ACGT" and cnt > ans:
            ans = cnt
            cnt = 0

        if i == len(S) - 1 and cnt > ans:
            ans = cnt
            cnt = 0

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
s=input()
acgt=["A","C","G","T"]
res=0
for i in range(len(s)):
    for j in range(i,len(s)):
        t=s[i:j+1]
        tmp=False
        for j in t:
            if not j in acgt:
                tmp=True
                break
        if tmp:
            continue
        res=max(res,len(t))
print(res)

Solution (Python):
s = str(input())
acgt = ['A','C','G','T']
cnt = 0
ans = 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):
ATCG = ['A', 'T', 'C', 'G']
S = input()

counts = []
a = 0
i = 0
while i < len(S):
    if S[i] in ATCG:
        a += 1
    else:
        counts.append(a)
        a = 0
    
    i += 1
    if i == len(S):
        counts.append(a)

print(max(counts))

Solution (Python):
def main():
    s = input()
    max_length = 0
    cur_length = 0
    for i, si in enumerate(s):
        if si in ["A", "T", "G", "C"]:
            cur_length+=1
        else:
            if max_length<cur_length:
                max_length = cur_length
            cur_length = 0

    if max_length<cur_length:
        max_length = cur_length
    print(max_length)

if __name__=="__main__":
    main()

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

Solution (Python):
s = input()

max = 0
cnt = 0

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

print(max)

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

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

Solution (Python):
s = input()

max = 0
count = 0

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

print(max)

Solution (Python):
if __name__ == "__main__":
    S = input()
    word_arr = ["A","T","G","C"]
    max_count,count = 0,0
    for c in S:
        if c in word_arr:
            count += 1
        else:
            max_count = max(count,max_count)
            count = 0
    max_count = max(count,max_count)
    print(max_count)

Solution (Python):
s = list(input())
count = 0
answer = 0

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

print(answer)

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

Solution (Python):
S=list(input())
a=0
b=[0]
for i in range(len(S)-1):
    if S[i]=='A' or S[i]=='C' or S[i]=='G' or S[i]=='T':
        b[len(b)-1]+=1
    if (S[i]=='A' or S[i]=='C' or S[i]=='G' or S[i]=='T') and (S[i+1]!='A' and S[i+1]!='C' and S[i+1]!='G' and S[i+1]!='T'):
        b.append(0)
if S[len(S)-1]=='A' or S[len(S)-1]=='C' or S[len(S)-1]=='G' or S[len(S)-1]=='T':
    b[len(b)-1]+=1
print(max(b))

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

for i in range(len(S)):
    if S[i] in acgt:
        mylist.append(mylist[-1]+1)
    else:
        mylist.append(0)
print(max(mylist))

Solution (Python):
s = input()
streak = 0
nowst = 0
ls = {"A", "C", "G", "T"}
for i in s:
	if i in ls:
		nowst += 1
		streak = max(nowst, streak)
	else:
		nowst = 0
print(streak)

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

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

c = 0
m = 0

for x in a:
    if x in ["A", "C", "G", "T"]:
        c += 1
    else:
        m = max(m, c)
        c = 0

print(max(m, c))

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 c in sub:
      if c not in ["A","G","C","T"]:
        flg = False
    if flg:
      res = max(res,len(sub))
print(res)

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

Solution (Python):
def f(x):
  if x == "A" or x == "C" or x == "G" or x == "T":
    return "1"
  else:
    return "0"
S = input()
s = list(S)
n = len(s)
u = list(map(f,s))
U = "".join(u)
print(max(list(map(len,U.split("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):
N = input()
cnt = 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'):
    cnt += 1
    ans = max(cnt, ans)
  else:
    cnt = 0
print(ans)

Solution (Python):
S = input()
S_num = [0]*len(S)

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

print(max(S_num))

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

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

Solution (Python):
s = str(input())
mx = 0
for i in range(len(s)):
    for j in range(i+1,len(s)+1):
        cnt = j-i
        p = 0
        for k in list(s[i:j]):
            if k in ["A","C","G","T"]:
                p += 1
        if p == cnt:
            if p > mx:
                mx = p
print(mx)

Solution (Python):
s=str(input())
word=["A","C","G","T"]
con,ans=0,0
for i in range(len(s)):
    if s[i] in word:
        for x in range(len(s)-i):
            if s[i+x] in word:
                con+=1
            else:
                break
        if con > ans:
            ans=con
        con=0
print(ans)

Solution (Python):








s = input()
n = len(s)
def func(s):
    if s == "A" or s == "C" or s == "G" or s == "T":
        return True
    else:
        return False

ans = 0
for i in range(n):
    le = 0
    if func(s[i]):
        le = 1
        for j in range(i+1,n):
            if func(s[j]):
                le += 1
            else:
                break
    ans = max(ans, le)
print(ans)

Solution (Python):
s = input()

max = 0
tmp = 0

for c in s:
    if c in ['A', 'C', 'G', 'T']:
        tmp += 1
        if tmp > max:
            max = tmp
    else:
        tmp = 0

print(max)

Solution (Python):
def main():
    s = str(input())
    count = 0
    count_lst = [0]
    flag = False

    for i in range(len(s)):
        letter = s[i]
        string = 'ACGT'

        if letter in string:
            count += 1
            flag = True

        else:
            if flag:
                count_lst.append(count)
            count = 0
            flag = False

    if flag:
        count_lst.append(count)
    longest = max(count_lst)
    print(longest)


if __name__ == '__main__':
    main()

Solution (Python):
s = input()

ans = 0
flag = True
li = ['A', 'C', 'G', 'T']

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

print(ans)

Solution (Python):
def main():
    S = input()
    size = len(S)
    ans = 0
    for left in range(size):
        for right in range(left, size):
            T = S[left:right + 1]
            if set(T) <= set("ACGT"):
                ans = max(ans, right - left + 1)
    print(ans)

    return


if __name__ == "__main__":
    main()

Solution (Python):
S = input()



num = 0
result = [0]

    
for c in S:
  if c == 'A' or c == 'C' or c == 'G' or c == 'T':
    num += 1
  else:
    result.append(num)
    num = 0
result.append(num)
    

print(max(result))

Solution (Python):

import sys
input=sys.stdin.readline

def main():
    strings = input()
    answers=[]
    counter=0

    for string in strings:
        if "A" in string or "C" in string or "G" in string or "T" in string:
            counter+=1
        else:
            answers.append(counter)
            counter=0
    print(max(answers))


if __name__=="__main__":
    main()

Solution (Python):
S = input()

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

print(ans)

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

cnt = 0
max_cnt = 0
acgt = ["A", "C", "G", "T"]

for e in s:
    if(acgt.count(e) == 1):
        cnt += 1
    else:
        if(cnt >= max_cnt):
            max_cnt = cnt
        cnt = 0

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

Solution (Python):
import re
print(max(map(len, re.split('[^ACGT]', input()))))