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

ans = 0
cnt = 0

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

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

print(ans)

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

count = 0
clist = []
n = (len(l))
for i in range(n):
    if l[i] in 'ACGT':
        count += 1
        if i == n - 1:
            clist.append(count)
    else:
        clist.append(count)
        count = 0

print(max(clist))

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

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

now = 0
ans = 0

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

print(ans)

Solution (Python):


s = list(str(input()))

set_ = set(["A", "C", "G", "T"])

ans = 0
count = 0
for i in range(len(s)):
    if s[i] in set_:
        count += 1
    else:
        ans = max(ans, count)
        count = 0

ans = max(ans, count)

print(ans)

Solution (Python):

import sys


def solve(S: str):
    acgt = [1 if s in ["A", "C", "G", "T"] else 0 for s in S]
    ans = 0
    tmp = 0
    for a in acgt:
        if a == 0:
            ans = max(ans, tmp)
            tmp = 0
            continue
        tmp += a
    ans = max(ans, tmp)
    print(ans)
    return



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

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


if __name__ == "__main__":
    main()

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

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

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

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

print(ans)

Solution (Python):
s = input()

x = []
ss = ["A","T","G","C"]

for i in range(len(s)):
  if(i != len(s)):
    for j in range(i+1,len(s)+1):
      x.append(s[i:j])
  else:
    x.append(s[-1])
ans = []
ans.append(0)
for i in range(len(x)):
  tmp = 0
  for j in range(len(x[i])):
    if(x[i][j] in ss):
      tmp += 1
  if(tmp == len(x[i])):
    ans.append(tmp)
print(max(ans))

Solution (Python):
s = input()
acgt = ['A','C','G','T']
i = 0
max = 0
count = 0

while i < len(s):
    if s[i] in acgt:
        count+=1
        if count > max:
            max = count
    else:
        count = 0
    i+=1

print(max)

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

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

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

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10000000)
import numpy as np
from heapq import heapify, heappop, heappush
import copy
from collections import deque

from bisect import bisect_left, bisect_right









def main():
    S = input()
    max_num = 0
    num = 0
    for i in S:
        if i in ['A', 'T', 'G', 'C']:
            num += 1
            max_num = max(num, max_num)
        else:
            num = 0
    print(max_num)



if __name__ == '__main__':
    main()

Solution (Python):
s = input()
n = len(s)
dp = [0]*n
if s[0] in 'ATGC':
    dp[0]=1
for i in range(1,len(s)):
    if s[i] in 'ATGC':
        dp[i]=1
    if s[i-1]!=0 and dp[i]!=0:
        dp[i]+=dp[i-1]
print(max(dp))

Solution (Python):
import re

s = input()
l = [len(s) for s in re.findall(r'[ACGT]+', s)]
print(0 if len(l) == 0 else max(l))

Solution (Python):
S = input()
cnt = 0
cntOld = 0
for n in range(len(S)):
    if S[n] == 'A' or  S[n] == 'C' or S[n] == 'G' or S[n] == 'T':
        cnt += 1
    else:
        if cntOld < cnt:
            cntOld = cnt
            cnt = 0
if cntOld < cnt:
    cntOld = cnt
print(cntOld)

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

Solution (Python):
S = list(input())
ans, p = 0, ""
for s in S:
    if s in  ["A", "C", "G", "T"]:
        p += s
    else:
        p = ""
    ans = max(ans, len(p))
    
print(ans)

Solution (Python):
s=list(map(str,input()))
l=[[]]
count=0
for i in s:
    if i=='A' or i=='C' or i=='G' or i=='T':
        l[count].append(i)
    else:
        count+=1
        l.append([])
maxl=0
for j in l:
    if len(j)>maxl:
        maxl=len(j)
print(maxl)

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

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

print(ans)

Solution (Python):
s = input()

acgt = set("ACGT")

ans = 0

for i in range(len(s)):
    l = 0
    for j in range(i, len(s)):
        if s[j] in acgt:
            l += 1
            if j == len(s)-1:
                ans = max(ans, l)
        else:
            ans = max(ans, l)
            break

print(ans)

Solution (Python):
import sys
import math
import collections
from collections import deque
from functools import reduce
import heapq


s = input()


ans = 0
for i in range(len(s)):
    p = 0
    for j in range(i, len(s)):
        if s[j] == "A":
            p += 1
        elif s[j] == "G":
            p += 1
        elif s[j] == "C":
            p += 1
        elif s[j] == "T":
            p += 1
        else:
            if p != 0:
                break
            else:
                continue

    if p > ans:
        ans = p

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 = list(input())
ans, p = 0, ""
for s in S:
    if s in ["A", "C", "G", "T"]:
        p += s
    else:
        p = ""
    ans = max(ans, len(p))
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(len(S[i:j+1]), ans)
print(ans)

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

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

ansLst = []

for i in range(len(S)):
    tmp = []
    for j in range(i, len(S)):
        if S[j] in targetLst:
            tmp.append(S[j])
        else:
            break
    ansLst.append(len(tmp))

ansLst.sort()
ansLst.reverse()

print(ansLst[0])

Solution (Python):
import re
S = str(input())
acgt = re.compile(r"[A,C,G,T]*")
s = re.findall(acgt, S)
print(max(map(len,s)))

Solution (Python):
S = input()
ans = 0
count = 0
for i in range(len(S)):
    if S[i] in 'ACGT':
        count +=1
    else:
        count=0
    if ans<count:
        ans=count

print(ans)

Solution (Python):
S = list(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()

acgt_max = 0
for i in range(len(s)):
    for j in range(i, len(s)):
        if s[j] != 'A' and s[j] != 'C' and s[j] != 'G' and s[j] != 'T':
            acgt_max = max(acgt_max, j - i)
            break
    else:
        acgt_max = max(acgt_max, j - i + 1)
print(acgt_max)

Solution (Python):
S=list(input())
count,count_max=0,0
for s in S:
  if s != 'A' and s != 'C' and s != 'G' and s != 'T':
    count = 0
  else:
    count += 1
  count_max=max(count_max,count)

print(count_max)

Solution (Python):
s = input()

ans = 0
flag = 0
alist = []

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


for i in s:
    if i in acgt:
        ans += 1
    else:
        alist.append(ans)
        ans = 0
alist.append(ans)

print(max(alist))

Solution (Python):
s = str(input())
cnt = 0
cnt_max = 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 cnt > cnt_max:
            cnt_max = cnt
    else:
        cnt = 0
print(cnt_max)

Solution (Python):

import sys
input = sys.stdin.readline
S =input().strip()


count =0
count_list=[0]
for i in S:
    if i in "ACGT":
        count +=1
        count_list.append(count)
    else:
        count =0
print(max(count_list))

Solution (Python):
L = ['A','C','G','T']
S = list(input()) 
S = ['1' if ((i in L) == True) else '0' for i in S]
S = ''.join(S)
S = S.split('0')
S = [len(i) for i in S]
print(max(S))

Solution (Python):
S_list = list(input()) 
S_list = ['1' if i == 'A' or i == 'C' or  i == 'G' or i == 'T' else '0' for i in S_list]
S = ''.join(S_list)
S = S.split('0')
X = 0
for i in range(len(S)):
    if len(S[i]) > X:
        X = len(S[i])
print(X)

Solution (Python):
s = input()

acgt_len = 0
max_len = 0

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

for i in range(len(s)):
    if s[i] in ACGT:
        acgt_len += 1
    else:
        max_len = max(acgt_len, max_len)
        acgt_len = 0

print(max(acgt_len, max_len))

Solution (Python):
S = input()
result = 0

streak = 0
for s in S:
    if s == 'A' or s == 'T' or s == 'G' or s == 'C':
        streak += 1
    else:
        result = max(streak, result)
        streak = 0
result = max(streak, result)
print(result)

Solution (Python):
from sys import stdin
def main():
    
    readline=stdin.readline
    s=readline().strip()
    ans=0
    atgc=("A","T","G","C")
    for i in range(len(s)):
        for j in range(i+1,len(s)+1):
            cnt=0
            t=s[i:j]
            for c in t:
                if c in atgc:
                    cnt+=1
                else:
                    break
            else:
                ans=max(ans,cnt)

    print(ans)            

if __name__=="__main__":
    main()

Solution (Python):
s = list(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()

ans = 0
for i in range(len(S)):
    for j in range(i+1, len(S)+1):
        s = S[i:j]
        for c in s:
            if c not in "ACGT":
                break
        else:
            ans = max(ans, len(s))

print(ans)

Solution (Python):
import itertools,sys
def S(): return sys.stdin.readline().rstrip()
S = S()
ans = 0
for i,j in itertools.combinations_with_replacement(range(len(S)),2):
    if all([x in 'ACGT' for x in S[i:j+1]]):
        ans = max(ans,j+1-i)
print(ans)

Solution (Python):
import itertools,sys
def S(): return sys.stdin.readline().rstrip()
S = S()
ans = 0
for i,j in itertools.combinations_with_replacement(range(len(S)),2):
    if all(x in 'ACGT' for x in S[i:j+1]):
        ans = max(ans,j+1-i)
print(ans)

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

Solution (Python):
import sys
def S(): return sys.stdin.readline().rstrip()
S = S()
ans,temp = 0,0
for x in S:
    if x in 'ACGT':
        temp += 1
        ans = max(ans,temp)
    else:
        temp = 0
print(ans)

Solution (Python):
import sys
def S(): return sys.stdin.readline().rstrip()
S = S()
N = len(S)
dp = [0]*(N+1)
for i,x in enumerate(S,1):
    if x in 'ACGT':
        dp[i] = dp[i-1]+1
print(max(dp))

Solution (Python):
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy

s = input()
ans = ""
koho = []
for i in range(len(s)):
    ans = ""
    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
        ans = s[i]
        for j in range(i+1,len(s)):
            if s[j] == "A" or s[j] == "C" or s[j] == "G" or s[j] == "T":
                ans += s[j]
            else:
                break
    koho.append(ans)
s = set(koho)
c = 0
for i in s:
    c = max(c,len(i))
print(c)

Solution (Python):
s=list(input())
ans=0
f=0
mae=True
for x in s:
  if x=="A" or x=="G" or x=="C" or x=="T":
    f+=1
  else:
    f=0
  
  ans=max(ans,f)
  
print(ans)

Solution (Python):
import sys

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


def main():
    S = readline().strip()
    ACGT = {'A', 'C', 'G', 'T'}

    ans = 0
    for left in range(len(S)):
        for right in range(1, len(S) + 1):
            if all(c in ACGT for c in S[left:right]) and ans < right - left:
                ans = right - left

    print(ans)
    return


if __name__ == '__main__':
    main()

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

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):
s = list(input())
ans = 0
x = ["A","T","G","C"]
c = 0
for i in range(len(s)):
    if (s[i] in x) == True:
        c += 1
        if ans < c:
            ans = c
    else:
        c = 0
print(ans)

Solution (Python):
S=list(input())
ans=0; c=0
for i in range(len(S)):
    if not S[i] in list('AGCT'): c=0
    else:
        c+=1
        ans=max(ans,c)
print(ans)

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

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


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


def ii():
    return int(input())


S = input()
ACGT = ["A", "C", "G", "T"]

length = 0
max_length = 0

for i in range(len(S)):
    if S[i] in ACGT:
        for j in range(i, len(S)):
            if S[j] in ACGT:
                length += 1
            else:
                max_length = max(max_length, length)
                length = 0
                break
        max_length = max(max_length, length)
        length = 0

print(max_length)

Solution (Python):
s = list(str(input()))
for i in range(len(s)):
    if s[i] in 'ATCG':
        s[i] = 1
    else:
        s[i] = 0
def shakutori(a, k):
    right, cnt = 0, 0
    for left in range(len(a)):
        while right < len(a) and a[right] == k:
            right += 1
        cnt = max(cnt, right - left)
        if right == left:
            right += 1
    return cnt
print(shakutori(s, 1))

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

for i in range(len(s)):
    if s[i] in l:
        c += 1
        if c > ans:
            ans = c
    else:
        c = 0

print(ans)

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

Solution (Python):
S = input()
res = 0
counts=0
for i in range(len(S)):
  if S[i] in "ACGT":
    counts+=1
  else:
    res=max(res,counts)
    counts=0
print(max(res,counts))

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 6)

int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def printlist(lst, k='\n'): print(k.join(list(map(str, lst))))
INF = float('inf')

def solve():
    S = list(input())

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


if __name__ == '__main__':
    solve()

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

tmp = 0
ans = 0

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

ans = max(ans , tmp)
print(ans)

Solution (Python):
S = input()

max_len = 0
cnt = 0
acgt = ['A', 'C', 'G', 'T']

for i in range(len(S)):
    if S[i] in acgt:
        cnt += 1
        if max_len < cnt:
            max_len = cnt
    else:
        cnt = 0

print(max_len)

Solution (Python):
import  re

ss = input()
ps = r"A|C|G|T"

seq = []
counter = 0
for s in ss:
    if re.match(ps, s):
        counter += 1
        seq.append(counter)
    else:
        counter = 0
seq.append(counter)
print(max(seq))

Solution (Python):
s = input()

acgt = ['A', 'C', 'G', 'T']
count = 0
ans = 0

for i in range(len(s)):
    if s[i] in acgt:
        count += 1
    ans = max(ans, count)
    if not s[i] in acgt:
        count = 0

print(ans)

Solution (Python):
s=input()
count=0
ans=0
for i in s:
    if i=='A'or i=='C' or i=='G'or i=='T':
        count+=1
        if count>ans:
            ans=count
    else:
        count=0
print(ans)

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

Solution (Python):
ss = input()
dic = {'A': 1, 'C': 1, 'G': 1, 'T': 1}
max_s = 0
tmp = 0
for s in ss:
    if s in dic.keys():
        tmp += 1
    else:
        max_s = max(max_s, tmp)
        tmp = 0
max_s = max(max_s, tmp)
print(max_s)

Solution (Python):

import re

S = input()

pattern = "[A|T|G|C]+"
match_result = re.findall(pattern, S)

ans = 0
for word in match_result:
    if ans <= len(word): ans = len(word)

print(ans)

Solution (Python):
S = input()
result = 0
for i in range(len(S)):
    for j in range(1, len(S) - i + 1):
        flg = True
        for c in tuple(S[i:i + j]):
            if not (c == 'A' or c == 'C' or c == 'G' or c == 'T'):
                flg = False
            if not flg:
                break
        if flg:
            if result < len(S[i:i + j]):
                result = len(S[i:i + j])
print(result)

Solution (Python):
def main():
    s = list(input())
    count_list = [0] * 1
    index = 0
    for i in s:
        if i == "A" or i == "T" or i == "G" or i == "C":
            count_list[index] += 1
        else:
            index += 1
            count_list.append(0)
    
    ans = max(count_list)
    
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
s = input()
n = len(s)
l = list("ACGT")
A = 0
for i in range(n):
  for j in range(i+1,n+1):
    x = s[i:j]
    if all(k in l for k in x):
      A = max(A,len(x))
print(A)

Solution (Python):
s=input()
count=0
a=0
for i in s:
    if i=='A' or i=='C' or i=='G' or i=='T':
        count+=1
        if a<count:
            a=count
    else:
        count=0
print(a)

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

Solution (Python):
S=lambda:input()
I=lambda:int(input())
L=lambda:list(map(int,input().split()))
LS=lambda:list(map(str,input().split()))

s=S()
ans=0
n=len(s)
for i in range(n):
    for j in range(i,n):
        if all('AGCT'.count(c)==1 for c in s[i:j+1]):
            ans=max(ans,j-i+1)
print(ans)

Solution (Python):
S=lambda:input()
I=lambda:int(input())
L=lambda:list(map(int,input().split()))
LS=lambda:list(map(str,input().split()))

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

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

result = []
for i in range(len(S)):
    tmp = 0
    for j in range(len(S)-i):
        if S[j+i] in list:
            tmp += 1
        else:
            break
    result.append(tmp)
print(max(result))

Solution (Python):
s=input()
l=list("ACGT")
ans=0
for i in range(len(s)):
    for k in range(i+1,len(s)+1):
        if all(j in l for j in s[i:k]):
            ans=max(ans,len(s[i:k]))
print(ans)

Solution (Python):

s = input()
j = 0
ans = 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=input()+"O"
tmp=""
ans=[]
for i in s:
  if i in ["A","T","G","C"]:
    tmp=tmp+i
  else:
    ans.append(tmp)
    tmp=""
res=0
for i in ans:
  if len(i)>res:
    res=len(i)
print(res)

Solution (Python):
from operator import itemgetter
s = input()
l = len(s)
ans = []
flag = False 
for i in range(l):
    if flag:
        if s[i] in "AGCT":
            continue
        else:
            ans.append([i-start,start,i])
            flag = False
    if s[i] in "AGCT":
        flag = True
        start = i 
else:
    if flag:
        ans.append([l-start,start,l])
ans.sort(key=itemgetter(0),reverse=True)

if ans:
    print(ans[0][0])
else:
    print(0)

Solution (Python):

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

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

Solution (Python):
def get_maxlen():
    S = input()
    N = len(S)
    for i in range(N, 0, -1):
        for j in range(N - i + 1):
            if set(S[j:j + i]).issubset({'A', 'T', 'C', 'G'}):
                return i
    return 0


print(get_maxlen())

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

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=list(input())
ans = 0
for i in range(len(s)):
    a = 0
    for j in range(i,len(s)):
        if s[j] == "A" or s[j] == "C" or s[j] == "G" or s[j] == "T":
            a += 1
        else:
            break
    if a >ans:
        ans = a
print(ans)

Solution (Python):

S = input()


ACGT = ["A", "C", "G", "T"]
S_len = len(S)
max_len = max(
    set(
        [
            len(S[i:j])
            for i in range(S_len)
            for j in range(S_len + 1, i, -1)
            if S[i:j].replace("A", "").replace("C", "").replace("G", "").replace("T", "") == ""
        ] + [0]
    )
)

print(max_len)

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

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

Solution (Python):
s=input()
l=len(s)
ans=''
anslen=0
for i in range(l):
    for j in range(i,l):
        ok=True
        for ss in s[i:j+1]:
            if ss not in ['A','C','G','T']:
                ok=False
                break
        if ok:
            if anslen<j-i+1:
                ans=s[i:j+1]
                anslen=j-i+1
print(anslen)

Solution (Python):
S = input().strip()
popa = list("ACGT")
maxx = 0
counter = 0
for i in S:
  if i in popa:
    counter+=1
  else:
    maxx = max(maxx,counter)
    counter = 0
maxx = max(maxx,counter)
print(maxx)

Solution (Python):
s = str(input())
t = "ATCG"
ans = 0

for i in range(len(s)):
    now = 0
    for j in range(i, len(s)):
        ok = False
        for k in range(len(t)):
            if s[j] == t[k]:
                ok = True
        if ok:
            now += 1
            ans = max(ans, now)
        else:
            break
print(ans)

Solution (Python):

s = input()

res = 0
res_max = 0
res_s=""
temps = ""
for i in range(len(s)):



    if s[i] in "ACGT":
        
        res += 1
        temps += s[i]
        if(len(temps) > len(res_s)):
            res_s = temps
            res_max = res
    else:
        res = 0
        temps = ""


print(res_max)

Solution (Python):

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

Solution (Python):


S = input()

s = ''
base = ('A', 'C', 'G', 'T')
max_len = 0

for c in S:
    if c not in base:
        s = ''
        continue

    s += c

    current_len = len(s)
    if max_len < current_len:
        max_len = current_len

print(max_len)

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

Solution (Python):
s= input()

import re

str_s = re.findall('[ATGC]+',s)

length = [len(p) for p in str_s]

if length==[]:
    print(0)
else:
    print(max(length))

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

Solution (Python):
import math
import itertools









def main():
    S = input()

    acgt = set(['A', 'C', 'G', 'T'])

    ans = 0
    for i in range(1, len(S) + 1):
        for j in range(len(S) - i + 1):
            if not set(S[j:j + i]) - acgt:
                ans = max(ans, len(S[j:j + i]))

    print(ans)


list(itertools.combinations([1, 2, 3, 4], 2))

if __name__ == '__main__':
    main()

Solution (Python):
s = input().rstrip()
ans = 0
for i in range(len(s)):
    n = 0
    for j in range(i, len(s)):
        if s[j] not in 'ACGT':
            break
        n += 1
    ans = max(ans, n)
print(ans)

Solution (Python):
"""
問題文
英大文字からなる文字列 S が与えられます。S の部分文字列 (注記を参照) であるような最も長い ACGT 文字列 の長さを求めてください。
ここで、ACGT 文字列とは A, C, G, T 以外の文字を含まない文字列です。
"""
import string
str_up = string.ascii_uppercase.replace("A","").replace("C","").replace("G","").replace("T","")
S = input()
part = []
for i in range(len(S)):
    for j in range(len(S)-i+1):
        part.append(S[i:i+j])
max_s = 0

for i in part:
    for j in str_up:
        if j in i:
            break
        elif j == "Z":
            if len(i) > max_s:
                max_s = len(i)
print(max_s)

Solution (Python):
S=list(input())
line=[]
A=["A","C","G","T"]
num_list=[]
flag=False
for s in S:
    if s in A:
        line.append(s)
        flag=True
    elif flag:
        num_list.append(len(line))
        line=[]
        flag=False
num_list.append(len(line))
if len(num_list)==0:print(0)
else:
    print(max(num_list))

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

ans = 0
for i in range(N + 1):
  for j in range(N + 1):
    if i <= j:
      x = 0
      for k in S[i : j]:
        if k in AGCT:
          x += 1
        else:
          ans = max(ans, x)
          x = -1 * N
    ans = max(ans, x)   
       
ans = max(ans, x)        
print(ans)

Solution (Python):
x=0
ans=0
for i in input():
    if not i in 'ACGT':
        x=0
    else:
        x+=1
        ans = max(ans, x)
print(ans)

Solution (Python):

S = input()
cnt=0
LEN = len(S)+1
for s in range(LEN):
    for e in range(LEN):
        if len(set(S[s:e])-set(['A','G','C','T']))==0 and len(S[s:e])>cnt:
            cnt = len(S[s:e])
print(cnt)

Solution (Python):
S = input()
N = len(S)
l = []
for i in range(N):
  for j in range(i,N):
    s = S[i:j+1]
    if s.strip("A C G T") == "":
      l.append(s)
if len(l) == 0:
  print(0)
  exit()
      
m = sorted(l, reverse=True, key=len)
print(len(m[0]))

Solution (Python):
s = input()
seen = [0] * len(s)
ans = 0
for i in range(len(s)):
    if s[i] in ['A', 'C', 'G', 'T']:
        tmp = 0
        k = 0
        while s[i + k] in ['A', 'C', 'G', 'T']:
            tmp += 1
            k += 1
            if i + k >= len(s):
                break
        ans = max(ans, tmp)

print(ans)

Solution (Python):
S = str(input())
cnt = 0
l = [0]

for i in range(len(S)):
  if S[i] in 'ATGC':
    cnt += 1
  else:
    l.append(cnt)
    cnt = 0
l.append(cnt)
print(max(l))

Solution (Python):
S = input()

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

print(ans)

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

for i in s:
    if word.count(i) == 1:
        tmp += 1
    else:
        tmp = 0

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

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

for i in s:
    if word.count(i) == 1:
        tmp += 1
    else:
        tmp = 0

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

Solution (Python):

def inp():
    return(int(input()))



def inlist():
    return(list(map(int, input().split())))



def instr():
    s = input()
    return(list(s[:len(s)]))



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


S = instr()

n = len(S)

acgt = "ACGT"
max_len = 0
for i in range(n):
    for j in range(i, n+1):
        s = S[i:j]
        flag = 1
        for ch in s:
            if ch not in acgt:
                flag = 0
                break
        if flag == 1:

            max_len = max(max_len, len(s))
print(max_len)