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()
mx = 0
for i in range(0,len(s)):
    for j in range(i,len(s)):
        sp = s[i:j + 1]
        
        at = True
        for k in range(j-i+1):
            if sp[k] != 'A' and sp[k] != 'G' and sp[k] != 'C' and sp[k] != 'T':
                at = False

        if at:
            mx = max(mx, len(sp))
            

print(mx)

Solution (Python):

def resolve():

    S = input()
    ans = 0
    ACGT = {"A", "C", "G", "T",}

    for i in range(len(S)):
        ss = S[i:]
        cnt = 0
        for s in ss:
            if s in ACGT:
                cnt += 1
            else:
                break
        ans = max(ans, cnt)
    return print(ans)
if __name__ == "__main__":
    resolve()

Solution (Python):
ACGT = ['A', 'C', 'G', 'T']
def ok(S):
    for c in S:
        if c not in ACGT:
            return False
    return True
def main():
    S = input()
    res = ''
    for i in range(len(S)):
        for j in range(1, len(S)+1):
            ps = S[i:j]
            if ok(ps) and len(ps) > len(res):
                res = ps

    print(len(res))
    

main()

Solution (Python):
s=input()
ACGT=["A","C","G","T"]
moji=[]
for i in range(len(s)):
    
    if s[i] in ACGT:
        moji.append(s[i])
        for j in range(i+1,len(s)):
            if s[j] in ACGT:
                moji[i]+=s[j]
            else:
                break
    else:
        moji.append("")
index=0
for i in moji:
    moji[index]=len(i)
    index+=1
print(max(moji))

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

Solution (Python):
import re

s = input()


mo = re.findall(r'([ACGT]+)', s)
if mo != None:
    ma = 0
    for m in mo:
        ma = max(ma, len(m))
    print(ma)
else:
    print(0)

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

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

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

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

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

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

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

Solution (Python):
import re

S = input()
raw = '[ACGT]+'
pattertn = re.compile(raw)
p = pattertn.findall(S)
if p is None:
    print(0)
else:
    m = 0
    for q in p:
        m = max(m,len(q))
    print(m)

Solution (Python):
s = str(input())
ACGT = {"A", "C", "G", "T"}

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

Solution (Python):

import re
s = input()
s2 = re.sub('[QWERYUIOPSDFHJKLZXVBNM]',' ',s)
ss = s2.split(' ')

ans = 0
for si in ss:
    ans = max(ans, len(si))
    
print(ans)

Solution (Python):
S = list(input())
pattern = 'ACGT'
ans = 0
length = 0

for c in S:
    if c in pattern:
        length += 1
        ans = max(ans, length)
    else:
        length = 0

print(ans)

Solution (Python):
s = input()
ans = 0
for l in range(len(s)):
    for r in range(l+1, len(s)+1):
        substr = s[l:r]
        if set(substr).issubset({"A", "C", "G", "T"}):
            ans = max(ans, len(substr))
print(ans)

Solution (Python):
import re

s = input()
m = re.findall(r"[ACGT]*", s)

print(max([len(i) for i in m]))

Solution (Python):
import sys
import itertools
import math
from collections import deque
MAX_INT = int(10e15)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

s = S()
N = len(s)
t = list("ACGT")

ans = 0
cnt = 0
for i in range(N):
  if s[i] in t:
    cnt += 1
  else:
    ans = max(ans, cnt)
    cnt = 0
else:
  ans = max(ans, cnt)

print(ans)

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

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 = str(input())
acgt = {"A", "C", "G", "T"}

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

Solution (Python):
s = input()
list_s = list(s)
k = 0
ans = []
for i in range(len(list_s)):
    c = list_s[i]
    if c == "A" or c == "C" or c == "G" or c == "T":
        k += 1
    else:
        ans.append(k)
        k = 0
if k != 0:
    ans.append(k)
print(max(ans))

Solution (Python):
s = input()

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

Solution (Python):
S = input()
A = list("ACGT")
k = 0
b = 0
for s in S:
    if s in A:
        b+=1
    else:
        b=0
    k = max(k,b)
print(k)

Solution (Python):
S = list(input())
def atgc(s):
    if s == "A" or s == "T" or s == "G" or s == "C":
        return True
    else:
        return False
c = 0
nax = 0
for i in range(len(S)):
    if atgc(S[i]):
        c += 1
        if i == len(S)-1:
            nax = max(nax,c)
    else:
        nax = max(nax,c)
        c = 0
print(nax)

Solution (Python):
s = input()
m = 0
l = 0
for c in s:
    if not (c == 'A' or c == 'C' or c == 'G' or c == 'T'):
        m = max(m, l)
        l = 0
        continue

    l += 1

m = max(m, l)
print(m)

Solution (Python):
x=input()
l=len(x)
maxx =[0]
a=0
for i in range(l):
  if x[i]=='A' or x[i]=='T' or x[i]=='C' or x[i]=='G':
    a+=1
    
    maxx.append(a)
  else:
    a=0
print(max(maxx))

Solution (Python):
base = set(["A", "C", "G", "T"])
ans = set([0])
cnt = 0

s = list(input())
for i in s:
    if i in base:
        cnt += 1
        ans.add(cnt)
    else:
        cnt = 0

m = max(ans)
print(m)

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

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

print(mx)

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

for i in range(len(s)):
  for j in range(i,len(s)):
    if all([k in li for k in s[i:j+1]]):
      ans=max(ans,j-i+1)
      
print(ans)

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

Solution (Python):
s = input()
l = []
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 i == len(s) - 1:
            l.append(cnt)
            
        
        
        
    elif i != "A" or i !="C" or i != "G" or i != "T":
        l.append(cnt)
        cnt = 0
        
print(max(l))

Solution (Python):
S = input()
acgt = {'A', 'C', 'G', 'T'}
length = len(S)
start = 0
ans = 0
while start < length:
  while start < length and S[start] not in acgt:
    start += 1
  right = start
  while right < length and S[right] in acgt:
    right += 1
  ans = max(ans, right - start)
  start = right
print(ans)

Solution (Python):
S=input()
N=len(S)
ans=0
d=set(list("AGCT"))

for i in range(N+1):
    for j in range(N+1):
        s=S[i:j]
        if set(list(s))<=d:
            ans=max(ans,len(s))
            
print(ans)

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

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

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

S = input().rstrip('\r\n')
ans = 0
count = 0
for s in S:
    if s == 'A' or s == 'C' or s == 'G' or s == 'T':
        count += 1
    else:
        ans = max(ans, count)
        count = 0
ans = max(ans, count)
print(ans)

Solution (Python):
def main():
    s = list(input())
    n = len(s)
    acgt = ["A", "C", "G", "T"]
    ans = 0
    for i in range(n):
        for j in range(i+1, n+1):
            flag = True
            for k in s[i:j]:
                if k not in acgt:
                    flag = False
                    break
            if flag:
                ans = max(len(s[i:j]), ans)
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
S=input()

ans=[]
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
    else:
        ans.append(count)
        count=0

ans.append(count)

print(max(ans))

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

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

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

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

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

for i in range(len(s)):
    if s[i] in 'ACGT':
        cnt += 1
        cnt_list.append(cnt)
    else:
        cnt = 0
        cnt_list.append(0)
print(max(cnt_list))

Solution (Python):
S=input()

max_bubun_length=0
tmp_bubun_length = 0
for i in range(len(S)):
    
    
    
    if S[i] in "ACGT":
        tmp_bubun_length += 1
    else:
        if tmp_bubun_length > max_bubun_length:
            max_bubun_length = tmp_bubun_length
            
        tmp_bubun_length = 0
if tmp_bubun_length > max_bubun_length:
    max_bubun_length = tmp_bubun_length
print(max_bubun_length)

Solution (Python):
S = input()
mode = 0
now = 0
k = []
for i in range(len(S)):
    if str(S[i]) == "A" or str(S[i]) == "T" or str(S[i]) == "G" or str(S[i]) == "C":
        if mode == 0:
            mode = 1
            now += 1
        else:
            now += 1
    else:
        k.append(now)
        now = 0
        mode = 0
k.append(now)
if len(k) == 0:
    print(0)
else:
    print(max(k))

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

Solution (Python):
*s, = input()

s.append(" ")

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

print(ans)

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

print(ans)

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

for i in range(len(s)):
    if l.count(s[i]) != 0:
        tmp+=1
    else:
        ans=max(tmp,ans)
        tmp=0
    ans=max(tmp,ans)
print(ans)

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

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] == '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
acgt = ['A','C','G','T']
for c in S:
    if c in acgt:
        cnt += 1
    else:
        if cnt > ans:
            ans = cnt
            cnt = 0

if cnt > ans:
    ans = cnt

print(ans)

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

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

Solution (Python):
s = input()

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

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

Solution (Python):
S = raw_input()

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

ans = 0
candi = 0
for item in S:
    if item in AGCT:
        candi = candi + 1
    else:
        ans = max(ans, candi)
        candi = 0

print max(ans, candi)

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

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    s = input()
    n = len(s)
    ans = 0
    r = 0
    for l in range(n):
        while r < n and s[r] in "ACGT":
            r += 1
        k = r-l
        if ans < k:
            ans = k
        if r <= l:
            r = l+1
    print(ans)
    return


if __name__ == "__main__":
    solve()

Solution (Python):
S = input()
maxS = 0
count = 0
for x in S:
    if x == "A" or x == "C" or x == "G" or x == "T":
        count += 1
    else:
        count = 0
    if maxS < count:
        maxS = count
print(maxS)

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

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

print(ans)

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

Solution (Python):
S = input()
max_S = 0
ACGT = ['A', 'C', 'G', 'T']
S2 = [1 if x in ACGT else 0 for x in S]
for i in range(len(S2)):
  for j in range(i+1, len(S)+1):
    if len(S[i:j])==sum(S2[i:j]):
      if len(S[i:j])>max_S:
        max_S = len(S[i:j])
print(max_S)

Solution (Python):
from itertools import groupby as gb
res = 0

s = [i in 'ATGC' for i in list(input())]
g = gb(s)
for k, v in g:
    if k == False:
        continue
    res = max(res, len(list(v)))
print(res)

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

Solution (Python):

s = list(input())

count = 0
l = []
for i in range(len(s)):
    if s[i] == 'A':
        count += 1
        continue
    elif s[i] == 'C':
        count += 1
        continue
    elif s[i] == 'G':
        count += 1
        continue
    elif s[i] == 'T':
        count += 1
        continue
    else:
        l.append(count)
        count = 0
l.append(count)

print(max(l))

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

ans = 0
for i in range(n+1):
    for j in range(i+1):
        if all([a in 'ATGC' for a in s[j:i]]):
            ans = max(ans, len(s[j:i]))
print(ans)

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

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

print(ans)

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

    ans=max(ans,count)

print(ans)

Solution (Python):
a=[i for  i in input()]
st=['A','C','G','T'] ; ct=0 ; maxx=0
for i in a:
    if i in st:
        ct+=1
    else:
        maxx=max(maxx,ct)
        ct=0
maxx=max(maxx,ct)
print(maxx)

Solution (Python):
import re

split = re.split('[^ACGT]', input())

print(max(map(len, split)))

Solution (Python):
import re
S=input()
S2=(re.sub('[^{ACGT}]', ' ', S))
S3=S2.split()
L=0
for i in range(len(S3)):
    if len(S3[i])>L:
        L=len(S3[i])
print(L)

Solution (Python):
A = list(input())
max_nu = 0 
nu = 0
for i in range(len(A)):
    if A[i] == "A" or A[i] == "C" or A[i] == "G" or A[i] == "T":
        nu += 1
        if max_nu < nu:
            max_nu = nu
    else:
        nu = 0
print(max_nu)

Solution (Python):
def main(s):
    res = 0
    val = 0
    lst = ["A","C","G","T"]
    for i in range(len(s)):
        if s[i] in lst:
            val += 1
        else:
            res = max(res, val)
            val = 0
    return max(res,val)

s = input()
print(main(s))

Solution (Python):
S=input()
start=1
end=0
ans=[]
for _ in range(len(S)):
    for i in range(len(S))[end:]:
        if S[i] in {"A","C","G","T"}:
            start=i
            break
    for j in range(len(S))[start:len(S)]:
        end=len(S)
        if S[j] not in {"A","C","G","T"}:
            end=j
            break
    ans.append(end-start)
if max(ans)<0:print(0)
else:print(max(ans))

Solution (Python):
S = input()
ACGT = ""
ans = 0
for i in range(len(S)):
    for j in range(len(S)-i):
        if(S[i+j] != "A" and S[i+j] != "C" and S[i+j] != "G" and S[i+j] != "T"):
            break
        ACGT = ACGT + S[i+j]
    ans = max(ans,len(ACGT))
    ACGT = ""
print(ans)

Solution (Python):
def all_part_string(s):
    r = range(len(s))
    return [s[i:j+1] for i in r for j in r if s[i:j+1] != '']

def contains_only(s, l):
    return False if [a for a in [e for e in s if e not in l] if a != ''] else True

if __name__ == '__main__':
    s = input()
    ss = all_part_string(s)
    o = [e for e in ss if contains_only(e, "ACGT")]
    print(0 if len(sorted(o, key=len, reverse=True)) == 0 else len(sorted(o, key=len, reverse=True)[0]))

Solution (Python):


s = input()

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

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

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

        
arr.append(count)
print(max(arr))

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

Solution (Python):



'''a,b= map(int,input().split())'''




N=input()
ans=ju=0
li=[]
li=list(N)

for i in range(len(li)):
  ans=0
  if str(li[i])=='T' or str(li[i])=='A' or str(li[i])=='G'or str(li[i])=='C':
    ans+=1
    for j in range(1,len(li)-i):
      if str(li[i+j])!='T' and str(li[i+j])!='A' and str(li[i+j])!='G' and str(li[i+j])!='C':
        break
      ans+=1
    ju=max(ju,ans)
print(ju)

Solution (Python):
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
sys.setrecursionlimit(10 ** 7)

def check(In):
    return In != "A" and In != "C" and In != "G" and In != "T"

def main():
    s = ns()

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

if __name__ == '__main__':
    main()

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

len = 0
ans = 0

for c in S:
    if c in "ACGT":
        len += 1
        ans = max(len, ans)
    else:
        len = 0

print(ans)

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

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

length = len(s)
acgt = set("ACGT")

ans = 0
for i in range(length):
    for j in range(length):
        moji = s[i:][::-1]
        moji = moji[j:][::-1]
        if set(moji) <= acgt:
            ans = max(ans,len(moji))

print(ans)

Solution (Python):

import sys
from itertools import groupby

def solve(S: str):
    return max(map(len, map(lambda x: tuple(x[1]), filter(lambda x: x[0], groupby(S, lambda x: x in 'ATGC')))), default=0)

                          



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  
    print(solve(S))

if __name__ == '__main__':
    main()

Solution (Python):
s = [1 if i in ["A", "C", "G", "T"] else 0 for i in input()]
r = [0]
c = 0
for i, si in enumerate(s):
    if si == 1:
        c += 1
    if si == 0 or i == len(s) - 1:
        if c != 0:
            r.append(c)
            c = 0
print(max(r))

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

for i in range(len(s)):
    if s[i] in acgt:
        moji=s[i]
        cnt=1
        l.append(len(moji))
        while i+cnt < len(s):
            if s[i+cnt] in acgt:
                moji=s[i:i+cnt+1]
                
                cnt+=1
                l.append(len(moji))
            else:
                break
print(max(l))

Solution (Python):
s=input()

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

ans=-1
cnt=0
for i in range(len(s)):
        if s[i] in acgt:
                cnt+=1
        else:
                if ans < cnt:
                        ans=cnt
                cnt=0
if ans < cnt:
        ans=cnt
print(ans)

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

s = input()

left = right = 0
ans = 0

while left < len(s):
    right = left
    while right < len(s) and s[right] in pat:
        right += 1

    ans = max(ans, right - left)

    left = right + 1

print(ans)

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

Solution (Python):
s = input()

ans = 0

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

print(ans)

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

Solution (Python):
S = input()

targets = ("A", "C", "G", "T")
max_length = 0
current_length = 0
for s in S:
    if s in targets:
        current_length += 1
    else:
        current_length = 0
    if max_length <= current_length:
        max_length = current_length
print(max_length)

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

ACGT=['A','C','G','T']
tmp=''
MAX1=0
MAX2=0

for moji in S:
    if((moji in ACGT)==True):
        tmp+=moji
        MAX2=len(tmp)
    else:
        if(MAX1 < MAX2):
            MAX1=MAX2
        MAX2=0
        tmp=''

if(MAX1==0 or MAX1 < MAX2):
    MAX1=MAX2

print(MAX1)

Solution (Python):


S = str(input())


def is_ATGC(char):
    if char == "A" or char == "C" or char == "G" or char == "T":
        return True
    return False

def is_ATGC_str(s):
    is_ATGC_str = True
    for char in s:
        if not is_ATGC(char):
            is_ATGC_str = False
    return is_ATGC_str

len_max = 0
for start in range(len(S)):
    for end in range(start+1, len(S)+1):
        
        
        s = S[start:end]
        if is_ATGC_str(s) and len(s) > len_max:
            len_max = len(s)

print(len_max)

Solution (Python):
S = input()

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

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

Solution (Python):
def main():
    S = input()
    N = len(S)
    s = {"A", "G", "C", "T"}
    ans = 0
    for i in range(N):
        for j in range(i, N):
            T = S[i:i+(j-i+1)]
            if all(t in s for t in T):
                ans = max(ans, len(T))
    print(ans)


if __name__ == '__main__':
    main()

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

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

chrs = ('A', 'C', 'G', 'T')
max_len = 0
this_len = 0
for s in S:
  if s in chrs:
    this_len += 1
  else:
    this_len = 0

  max_len = max(this_len, max_len)

print(max_len)

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

Solution (Python):
S = input()
st = set(['A', 'G', 'C', 'T'])
ans = 0
for i in range(len(S)):
    for j in range(i, len(S)):
        string = S[i:j+1]
        if not string:
            continue
        flag = True
        for char in string:
            if char not in st:
                flag = False
        if flag:
            ans = max(ans, len(string))
print(ans)

Solution (Python):
lst = list(input())
cnt = 0
len_lst = []
for i in lst:
    if i == 'A' or\
       i == 'T' or\
       i == 'C' or\
       i == 'G':
        cnt += 1
        len_lst.append(cnt)
    else:
        len_lst.append(cnt)
        cnt = 0
print(max(len_lst))

Solution (Python):
s = input()

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

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

Solution (Python):
s = input()
acgt = ["A","C","G","T"]
c = ""
for i in s:
  if i in acgt:
    c+=i
  else:
    c+= " "
l = c.split()
if l:
	print(len(max(l, key=lambda x:len(x))))
else:
  print(0)

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

Solution (Python):
from collections import Counter

S = input()

ans = 0

for s in range(len(S)):
    for e in range(s + 1, len(S) + 1):
        if set(S[s:e]) <= set({'A', 'T', 'C', 'G'}):
            ans = max(ans, e - s)
        
print(ans)

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

length = 0

for s in range(n):
    for e in range(s, n):
        if all("ACGT".count(c)==1 for c in S[s:e+1]):
            length = max(length, e-s+1)

print(length)

Solution (Python):
s = input()
ans = [0] * 10 ** 3
cnt = 0

for i in range(len(s)):
    for j in range(1, len(s) + 1):
        memo = s[i:j]
        for k in range(len(memo)):
            if memo[k] == 'A' or memo[k] == 'C' or memo[k] == 'T' or memo[k] == 'G':
                cnt += 1
            else:
                break

        ans.append(cnt)
        cnt = 0

print(max(ans))

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

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


if __name__ == '__main__':
    main()

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

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

Solution (Python):
s = list(input())
ans = 0
for i in range(len(s)):
    for j in range(i, len(s)):
        
        if all(x == 'A' or x == 'C' or x == 'G' or x == 'T' for x in s[i:j+1]):
            
            if ans < len(s[i:j+1]):
                ans = len(s[i:j+1])
        
        
    

print(ans)

Solution (Python):
s = input()

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

ans = max(ans, cnt)

print(ans)

Solution (Python):
from collections import Counter
import sys

sys.setrecursionlimit(10 ** 6)

mod = 1000000007
inf = int(1e18)

dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]


def inverse(a):
    return pow(a, mod - 2, mod)


def usearch(x, a):
    lft = 0
    rgt = len(a) + 1
    while rgt - lft > 1:
        mid = (rgt + lft) // 2
        if a[mid] <= x:
            lft = mid
        else:
            rgt = mid
    return lft

def main():
    s = input()
    ans = 0
    n = len(s)
    for i in range(n):
        for j in range(i+1, n+1):
            if len([k for k in s[i:j] if k not in 'ACGT']) == 0:
                ans = max(ans, j - i)
    print(ans)


main()

Solution (Python):
s=input()

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

else:
    ans=max(ans,count)
print(ans)