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

ATCG = ['A','T','C','G']
ans = []
pre = 0
for s in S:
    if s in ATCG:
        pre += 1
    else:
        ans.append(pre)
        pre = 0

ans.append(pre)
print(max(ans))

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

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

for s in S:
    if s=="A" or s=="C" or s=="G" or s=="T":
        cnt += 1
        if cnt > max_cnt:
            max_cnt = cnt
    else:
        if cnt > max_cnt:
            max_cnt = cnt
        cnt = 0
        
print(max_cnt)

Solution (Python):
s = list(input())
t = ""
for l in s:
  if l == "A" or l == "C" or l == "G" or l == "T":
    t += l
  else:
    t += ","

list = [len(i) for i in t.split(",")]
print(max(list))

Solution (Python):
lststr = [i for i in input()]

lststr_replace = [s.replace("A", "target") for s in lststr]
lststr_replace = [s.replace("C", "target") for s in lststr_replace]
lststr_replace = [s.replace("G", "target") for s in lststr_replace]
lststr_replace = [s.replace("T", "target") for s in lststr_replace]

con = 0
maxcon = 0
for i in range(len(lststr)):
    if lststr_replace[i] == "target":
        con += 1
        if maxcon < con:
            maxcon = con
    else:
        con = 0
print(maxcon)

Solution (Python):

import re

S = input()

replaced_S = re.sub('[^ATCG]', ' ', S)

list_S = [s for s in replaced_S.split()]

max_length = 0
for s in list_S:
    if len(s) > max_length:
        max_length = len(s)

print(max_length)

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

ans = 0
start_index = 0
for end_index in range(len(S)):
  if S[start_index] == "A" or S[start_index] == "C" or S[start_index] == "G" or S[start_index] == "T":
    if S[end_index] == "A" or S[end_index] == "C" or S[end_index] == "G" or S[end_index] == "T":
      ans = max(ans,end_index - start_index + 1)
    else:
      start_index = end_index
  else:
    start_index = end_index

print(ans)

Solution (Python):
import re
s=re.split("[^ACGT]", input())
a=[]
for i in range(len(s)):
    a.append(len(s[i]))
print(max(a))

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

n = len(s)

cnt = 0
ans = 0

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

print(ans)

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

ans = 0
count = 0

for i in li:
    if  i == 'A' or i == 'C' or i == 'G' or i == 'T':

        count += 1

        ans = max(ans,count)

    else:
        count = 0

print(ans)

Solution (Python):
import re

li = re.findall("[ATGC]+", input())
res = 0
for st in li:
    le = len(st)
    if le > res:
        res = le

print(res)

Solution (Python):
code = input()
read_code = list(code)
count = 0
count_end = 0

for i in range(0, len(read_code)):
    code_count = False
    if read_code[i] == "A" or read_code[i] == "C" or read_code[i] == "G" or read_code[i] == "T":
        count += 1
        if(count >= count_end):
            count_end = count
    else:
        count = 0

print(count_end)

Solution (Python):


s=input()
list=[0,0,0,0,0,0,0,0,0,0]
j=0

for i in range(len(s)):
	if s[i]=="A" or s[i]=="T" or s[i]=="G" or s[i]=="C":
		list[j]+=1
	else:
		j+=1

print(max(list))

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

for i in range(length_S):
	length_substr = 0

	
	for j in range(length_S - i):
		if S[i + j] in ACGT:
			length_substr += 1
		else:
			break

	ans = max(ans, length_substr)

print(ans)

Solution (Python):
import re


S=input()
s=re.split('[^AGCT]', S)

x=max(s,key=len)

print(len(x))

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

Solution (Python):
S = input()

cnt = 0
ans = 0

for ss in S:
    if ss in 'ACGT':
        cnt += 1
    else:
        cnt = 0
    ans = max(ans,cnt)
    
print(ans)

Solution (Python):
S = input()

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

count = 0
ans = 0

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

print(ans)

Solution (Python):
s = input()
words = set()
words.add('')
words.add(s)
for i in range(len(s)):
    words.add(s[i])
    for j in range(i, len(s)+1):
        words.add(s[i:j])

matched = []
for w in words:
    n = 0
    for i in w:
        if i not in ['A', 'T', 'G', 'C']:
            n += 1
    if n == 0:
        matched.append(len(w))
print(max(matched))

Solution (Python):
S = input()

candidates = []

tmp = []

for char in S:
    if char in ["A", "T", "G", "C"]:
        tmp.append(char)
    else:
        candidates.append(tmp)
        tmp = []

if tmp != []:
    candidates.append(tmp)

sorted_candidates = sorted(candidates, reverse=True, key=lambda x: len(x))
print(len(sorted_candidates[0]))

Solution (Python):
S=input()
a=list(S)
for i in range(len(a)):
    if a[i] != 'A' and a[i] != 'G' and a[i] != 'C' and a[i] != 'T':
        a[i]='/'
b=''.join(a)
c=b.split('/')
ans=0
for j in range(len(c)):
    if ans<=len(c[j]):
        ans=len(c[j])
print(ans)

Solution (Python):
S = input()
_S = list(S)
for s in range(len(_S)):
    if _S[s] != ('A'):
        if _S[s] != ('C'):
            if _S[s] != ('G'):
                if _S[s] != ('T'):
                    _S[s] = ','
s_changed = "".join(_S)
_s = s_changed.split(',')
most = 0
for v in _s:
    if len(v) >= most:
        most = len(v)
print(most)

Solution (Python):
S = input()
atgc = 'ATGC'
c = 0
m = 0
for i in S:
    for j in atgc:
        if i == j:
            c += 1
            m = max(c, m)
            break
    else:
        c = 0
print(m)

Solution (Python):
import re
ll = list(map(len,re.sub('[^ACGT]',' ', input()).split()))
if len(ll) == 0:print(0)
else:print(max(ll))

Solution (Python):
s = input()

acgt_s = "ACGT"
count_s = 0
count_max = 0

for i in s:
    for j in acgt_s:
        if j == i:
            count_s += 1
            count_max = max(count_max, count_s)
            break
    else:
        count_s = 0


print(count_max)

Solution (Python):
S = input()
out = 0
hoge = 0

for k in S:
    if k == "A" or k == "T"or k == "G" or k == "C":
        hoge += 1      
        if hoge >= out:
            out = hoge
    else:
        hoge = 0

print (out)

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

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

print(ans)

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

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

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

print(ans)

Solution (Python):
def check_s(s,list):
    for i in range(len(s)):
        if not s[i] in list:
            return False

    return True


S = input()

l = len(S)

sub_S = ''
list = ['A','C','G','T']

max_len = 0

for k in range(l+1):
    for i in range(l+1-k):
        sub_S = S[i:i+k]
        
        if check_s(sub_S,list):
            if len(sub_S) > max_len:
                max_len = len(sub_S)

print(max_len)

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

Solution (Python):
ans = 0
lis =["A","G","C","T"]
foo = 0
for i in input()+"Z":
  if i in lis:
    foo += 1
  else:
    if ans < foo:
      ans = foo
    foo = 0
print(ans)

Solution (Python):
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b



def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)



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


def main():
    S = input()

    ans = 0
    for i in range(len(S)):
        for j in range(i + 1, len(S) + 1):
            t = S[i:j]

            ok = True
            for c in t:
                if c not in "ACGT":
                    ok = False
            if ok:
                ans = max(ans, len(t))

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
import re

S = input()
list = re.split("[BDEFHIJKLMNOPQRSUVWXYZ]", S)
max = 0
for x in list:
    if max < len(x):
        max = len(x)
print(max)

Solution (Python):
s=input()
ans=[]
I=[0]*len(s)
for i in range(len(s)):
    if (s[i]=="A" or s[i]=="T" or s[i]=="G" or s[i]=="C"):
        I[i]=1

    else:
        I[i]=0
for i in range(len(I)):
    if (I[i]==1 and I[i-1]==0) or (I[i]==1 and i==0):
        ans.append(1)
    elif (I[i]==1 and I[i-1]==1):
        ans[-1]+=1
if ans==[]:
    print(0)
else:
    print(max(ans))

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

cnt = 0
tmp = 0
for s in S:
  if s in agct:
    tmp = tmp + 1
  else:
    if tmp > cnt:
      cnt = tmp
      tmp = 0
  
if tmp > cnt:
  cnt = tmp

print(cnt)

Solution (Python):
S = input()
list = []
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
    list.append(counter)
print(max(list))

Solution (Python):
s = input()

temp = 0
c = 0
ACGT = ['A', 'C', 'G', 'T']

for i in range(len(s)):
    if s[i] in ACGT:
        temp += 1
    elif s[i] not in ACGT and temp != 0:
        if temp > c:
            c = temp
        temp = 0
    
    if i + 1 == len(s):
        if temp > c:
            c = temp

print(c)

Solution (Python):

S_lst = list(input())

S_len = len(S_lst)

count = 0

count_max = 0

for s in range(0, S_len):

    if S_lst[s] == "A" or S_lst[s] == "C" or S_lst[s] == "G" or S_lst[s] == "T":
        count += 1
        if count > count_max:
            count_max = count

    else:
        count = 0

print(count_max)

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

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

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

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

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

Solution (Python):
f = input()
m=[0,0,0,0,0]
i =0
for k in f:
    if (k=="A" and "T") or (k=="T" and "A") or (k=="C" and "G") or (k=="G" and "C"):
        m[i]+=1
    elif m[i] != 0:
        i += 1
print(max(m))

Solution (Python):

S=list(str(input()))
count=0
count_max=0

for ii in range(0,len(S)):
    if S[ii] == "A" or  S[ii] =="C" or  S[ii] =="G" or  S[ii] =="T":
        count += 1
        if count > count_max:
            count_max=count
    else:
        count=0

print(count_max)

Solution (Python):
str=list(input())
count=0
count_max=0
for list in str:
  if list=='A' or list=='C' or list=='G' or list=='T':
    count+=1
    if count>count_max:
      count_max = count
  else:
    count=0
    
print(count_max)

Solution (Python):


S=list(map(str, input()))
lenth=0
max=0
for i in range(len(S)):
    if S[i]=="A" or S[i]=="T" or S[i]=="C" or S[i]=="G":
            lenth+=1
    else:
        if max<lenth:
            max=lenth
            lenth=0
        else:
            lenth=0

if max<lenth:
    max=lenth

print(max)

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

Solution (Python):
def sub():
    S = input()
    maxCount = 0
    count = 0
    acgt = ["A", "C", "G", "T"]
    for c in S:
        if c in acgt:
            count = count + 1
            if count > maxCount:
                maxCount = count
        else:
            count = 0
    print(maxCount)



sub()

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

ans = 0
tmp = 0
for s in S:
    if s == 'A' or s == 'T' or s == 'G' or s == 'C':
        tmp += 1
        if tmp > ans:
            ans = tmp
    else:
        tmp = 0
print(ans)

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

ans = 0
num = 0

for i in range(len(S)):
  if S[i] == "A" or S[i] == "G" or S[i] == "T" or S[i] == "C":
    num = 1
    for j in range(i+1,len(S)):
      if S[j] == "A" or S[j] == "G" or S[j] == "T" or S[j] == "C":
        num = num + 1
      else :
        break
  if ans < num :
    ans = num
  num = 0
  
print(ans)

Solution (Python):
S=input()

ans = []
for i in range(len(S)):
    for j in range(len(S[i:])):
        if all([S[i:i+j+1][k] in ['A','C','G','T'] for k in range(len(S[i:i+j+1]))]):
            ans.append(S[i:i+j+1])
if len(ans) != 0:
    print(max(list(map(len,ans))))
else:
    print(0)

Solution (Python):
s=input()

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

print(max(counts))

Solution (Python):
S = input()

counts = []
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 i == len(S) - 1:
            counts.append(count)
    else:
        counts.append(count)
        count = 0

print(max(counts))

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

Solution (Python):
s = input()
a = ["A", "C", "G", "T"]
cnt = 0
_max = 0
for c in s:
    if c in a:
        cnt += 1
    else:
        cnt = 0
    if cnt > _max:
        _max = cnt
print(_max)

Solution (Python):
s = input()
max_count = 0
count = 0

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

print(max(max_count, count))

Solution (Python):
S = input()

cur, max_ = 0, 0
for c in S:
    if c in {'A', 'C', 'G', 'T'}:
        cur += 1
    else:
        max_ = max(cur, max_)
        cur = 0
max_ = max(cur, max_)
print(max_)

Solution (Python):
s=input()
s1="ATGC"
l=[]
count=0
for i in range(len(s)):
  if s[i] not in s1:
    l.append(count)
    count=0
  else:
    count=count+1
  if i==len(s)-1 and s[i] in s1:
    l.append(count)
    
print(max(l))

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

Solution (Python):
S=str(input())
length=0
longest=0

for i in range(len(S)):
    if S[i]!='A' and S[i]!='C' and S[i]!='G' and S[i]!='T':
        length=0
    else:
        length+=1
    if length>longest:
        longest=length
print(longest)

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

Solution (Python):
import re

s = input()
ans = 0
mch = re.findall('[ATGC]+', s)

for m in mch:
    if len(m) > ans:
        ans = len(m)
print(ans)

Solution (Python):
S = input()

max_count = 0
counter = 0
last_s_is_ACGT = False
for i in range(len(S)):
    if S[i] in ["A", "C", "G", "T"]:
        counter += 1
        if counter > max_count:
            max_count = counter
    else:
        counter = 0

print(max_count)

Solution (Python):
s = input()
temp = 0
max = 0

for i in range(len(s)):
    if ('A' in s[i]) :
        temp += 1
    elif ('C' in s[i]) :
        temp += 1
    elif ('G' in s[i]) :
        temp += 1
    elif ('T' in s[i]) :
        temp += 1
    else : temp = 0

    if temp > max :
        max = temp

print(max)

Solution (Python):



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

count = 0
max_val = 0

input_str = input()

for i in input_str:
    if(i in acgt_array):
        count += 1
    else:
        count = 0
    if(count > max_val):
        max_val = count
print(max_val)

Solution (Python):
inpString = [x for i in input().split() for x in i]
count = 0
maxCount = 0
lst = ["A","C","G","T"]
for i in inpString:
    if(i in lst):
        count+=1
        maxCount = max(maxCount,count)
    else:
        count=0
print(maxCount)

Solution (Python):
m=t=0
for _,c in enumerate(input()):
    t += 1 if 'ACGT'.find(c)>=0 else -t
    m=max(m,t)
print(m)

Solution (Python):
m=t=0
for _,c in enumerate(input()):
    if 'ACGT'.find(c)>=0:
        t+=1
        m=max(m,t)
    else:
        t=0
print(m)

Solution (Python):
s=input()
ans=0
for x in range(1,len(s)+1):
	for left in range(len(s)-x+1):
		z=s[left:left+x]
		flag=True
		for i in range(x):
			if z[i]!="A" and z[i]!="G" and z[i]!="C" and z[i]!="T":
				flag=False
				break
		if flag==True:
			ans+=1
			break
print(ans)

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

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

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

alp = 'BDEFHIJKLMNOPQRSUVWXYZ'

cnt = []

for i in range(0, N):
    for j in range(i, N+1):
        tmp = S[i:j]
        flg = 1
        for a in alp:
            if a in tmp:
                flg = 0
        if flg:
            cnt.append(len(tmp))

print(max(cnt))

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

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

mx = max(mx, len)

print(mx)

Solution (Python):
s = input()

l = [0]
cnt = 0
for i in s:
    if i in 'ATCG':
        cnt += 1
    else:
        if cnt > 0:
            l.append(cnt)
        cnt = 0
l.append(cnt)

print(max(l))

Solution (Python):
s = input()

atgc = "ATGCF"
ans = 0
flag = 0
tmp = 0
for c in s:
    for key in atgc:
        if c == key:
            tmp += 1
            flag = 1
            break
        if key == "F":
            flag = 0
    if tmp > ans:
        ans = tmp
    if flag == 0:
        tmp = 0
print(ans)

Solution (Python):
S = input()
S ="w"+ S + "w"
m = 0
n = 0
lst = []
for i in S:
  n += 1
  if i not in "ACGT":
    lst.append(n)
for y in range(len(lst)-1):
  if (lst[y+1] - lst[y]) > m:
    m = (lst[y+1] - lst[y])
print (m-1)

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

Solution (Python):

import sys


def isATCG(s):
    if s in "ATCG":
        return True
    return False

def solve(S: str):
    S1 = [0] * len(S)

    c = 0
    for i in range(len(S)):
        if isATCG(S[i]):
            c += 1
        else:
            c = 0
        S1[i] = c

    print(max(S1))

        


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()
lst = [i for i in s]
ans = []

cnt = 0
"""
まえから順にATGCのいずれかであるかを判定する
カウントは毎回ansに追加していくので、lstの要素分だけ追加される
同じ値が続けばカウントは1増えて配列ansにつかされる
最終出力は配列の中の最大値を出力する。
"""
for i in range(len(lst)):
    if s[i] == "A" or s[i] == "T" or s[i] == "G" or s[i] == "C":
        cnt += 1
    else:
        cnt = 0
    ans.append(cnt)

print(max(ans))

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

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:
        cnt = 0
    ans.append(cnt)
print(max(ans))

Solution (Python):
import sys


def input():
    return sys.stdin.readline()[:-1]









s = input()
max_count = 0
now_count = 0
target = ["A", "C", "G", "T"]
for c in s:
        if(c in target):
                now_count += 1
        else:
                max_count = max(max_count, now_count)
                now_count = 0
print(max(max_count, now_count))

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

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

Solution (Python):
s = input()
max_count = 0
now_count = 0
target = ["A", "C", "G", "T"]
for c in s:
        if(c in target):
                now_count += 1
        else:
                max_count = max(max_count, now_count)
                now_count = 0
print(max(max_count, now_count))

Solution (Python):
S = 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
    else:
        ans = max(ans, cnt)
        cnt = 0
ans = max(ans, cnt)
print(ans)

Solution (Python):
s = input()

ACGT = "ACGT"

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

print(max(max_num,cnt))

Solution (Python):
S = input()

count = [0]
counter = 0

for i in S:
  if i == "A" or i == "C" or i == "G" or i == "T":
    counter += 1
    count.append(counter)
  else:
    counter = 0

print(max(count))

Solution (Python):
s=input()
ans=0
tmp=0
acgt="ACGT"
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):
a = input()
ans=0
tmp=0
ren=False
for i in range(len(a)):
    if a[i] == "A" or a[i] == "T" or a[i] == "C" or a[i] == "G":
        if ren:
            tmp+=1
        else:
            ren = True
            tmp += 1
    else:
        if ren:
            ans = max(ans,tmp)
            ren = False
            tmp=0
ans = max(ans,tmp)
print(ans)

Solution (Python):
S = input()
ACGT = ["A", "C", "G", "T"]
K = []
for i in range(len(S)):
    if S[i] in ACGT:
        K.append(i)
if len(K) == 0:
    ans = 0
elif len(K) == 1:
    ans = 1
else:
    count = 0
    mx = 0
    for j in range(len(K)-1):
        if K[j+1]-K[j] == 1:
            count += 2
        else:
            ans = max(count, mx)
            count = 0
            mx = ans
    ans = max(count, mx)
    ans = ans/2 + 1
print(int(ans))

Solution (Python):
s = str(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().strip()
max_l = 0
for i in range(len(s)):
    for j in range(i, len(s)):
        if set(s[i:j+1]).issubset({'A', 'C', 'G', 'T'}):
            max_l = max(max_l, j+1 - i)

print(max_l)

Solution (Python):
s = (input())
N = len(s)
count_max = 0

alp = 'BDEFHIJKLMNOPQRSUVWXYZ'
n_alp = "ACGT"

for i in range(N):
  count = 0
  for j in range(N - i):
    if s[j + i] in n_alp:
      count += 1
    else :
      break
  if count > count_max:
    count_max = count

print(count_max)

Solution (Python):
def main():
    s=input()
    tmp = 0
    cnt = 0
    for i in s:
        if i =='A' or i == 'T' or i =='C' or i=='G':
            cnt +=1
        else:
            if tmp <= cnt:
                tmp = cnt
                cnt = 0
            else:
                cnt = 0

    print(max(tmp,cnt))

if __name__ == '__main__':
    main()

Solution (Python):
S= input()


r=[]
n=0
for a in S:
    if a in "ACGT":
        n+=1
    else:
        r.append(n)
        n=0
r.append(n)
print(max(r))

Solution (Python):
s = input()

max_len = 0
tmp_len = 0
for w in s:
    if w == "A" or w == "C" or w == "G" or w == "T":
        tmp_len += 1
    else:
        tmp_len = 0
    if max_len < tmp_len:
        max_len = tmp_len

print(max_len)

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):
def judge(character):
	if character == "A" or character == "T" or character == "C" or character == "G":
		return 1
	else:
		return 0

a = list(input())
total = [0]
turn = 0
for i in range(len(a)):
	b = judge(a[i])
	if b == 1:
		total[turn] += 1
	else:
		turn += 1
		total.append(0)
print(max(total))

Solution (Python):
s = input()
l = 0
acc = 0
for c in s:
  if c in "ACGT":
    acc += 1
    l = max(l, acc)
  else:
    acc = 0
    
print(l)

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

Solution (Python):
S = input()

num = 0
maxNum = 0
for i in S:

  if i in ["A","C","G","T"]:
    num += 1
    if maxNum < num:
      maxNum = num
  else:
    num = 0
print(maxNum)

Solution (Python):
S = input()

work = ""
maxlen = 0
lenwork = 0
for i in range(0, len(S)):
    if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
        if i > 0 and (S[i - 1] == "A" or S[i - 1] == "C" or S[i - 1] == "G" or S[i - 1] == "T"):
            work += S[i]
            lenwork += 1
        else:
            work = S[i]
            if lenwork == 0:
                lenwork = 1
    else:
        work = ""
        if lenwork > maxlen:
            maxlen = lenwork
        lenwork = 0

if lenwork > maxlen:
    maxlen = lenwork

print(maxlen)

Solution (Python):
s=input()
ans=0
temp=0
t="ACGT"
for i in range(len(s)):
  flag=False
  for j in range(4):
    if s[i]==t[j]:
      temp=temp+1
      ans=max(ans,temp)
      flag=True
  if flag==False:
    temp=0
print(ans)

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

for ii in range(len(S)):
    if ii == 0 and (S[ii] == 'A' or S[ii] == 'C' or S[ii] == 'G' or S[ii] == 'T'):
        ACGT_counter[ii] = 1
    elif S[ii] == 'A' or S[ii] == 'C' or S[ii] == 'G' or S[ii] == 'T':
        ACGT_counter[ii] = ACGT_counter[ii-1] + 1
    else:
        ACGT_counter[ii] = 0
        
print(max(ACGT_counter))

Solution (Python):
from sys import stdin
S = stdin.readline().rstrip()

n = len(S)
ans = 0
agct = {'A','G','C','T'}
bin_s = ''
for s in S:
    if s in agct:
        bin_s += '1'
    else:
        bin_s += '0'

right = 0
cnt = 0
for left in range(n):
    
    while (right < n and bin_s[right] == '1'):
        cnt += 1
        
        right += 1
    ans = max(ans, cnt)

    if (right == left):
        right += 1  
    cnt = 0
    
print(ans)

Solution (Python):
S = input()
check = []
for i in range(len(S)):
    if S[i] in ['A', 'C', 'G', 'T']:
        check.append(i)
ans = 1

if len(check) == 0:
    print(0)
else:
    num = 1
    for i in range(len(check) - 1):

        if check[i] + 1 == check[i+1]:
            num += 1
            ans = max(ans, num)
        else:
            num = 1
    print(ans)

Solution (Python):
str = input()
dif = ("A","C","G","T")

isdif = False
maxlen = 0
tempdif = ""
for c in str:
    if c in dif:
        if isdif:
            tempdif += c
        else:
            tempdif = c
            isdif = True
    else:
        isdif = False
        if len(tempdif) > maxlen:
            maxlen = len(tempdif)
        tempdif = ""
    if len(tempdif) > maxlen:
        maxlen = len(tempdif)
print(maxlen)

Solution (Python):
import sys

b = input()

flg = 0
n = 0
nw = []
for bi in b:
    if bi == 'A' or bi == 'G' or bi == 'C' or bi == 'T':
        flg = 1
        n += 1
    else:
        flg = 0
        n = 0
    nw.append(n)

nw.sort(reverse = True)
print(nw[0])

Solution (Python):


b = input()

ans = 0
max = 0
for char in b:
    if char in ["A", "C", "G", "T"]:
        ans += 1
    else:
        ans = 0
    if max < ans:
        max = ans

print(max)

Solution (Python):
s = input()
acgt='ACGT'

x = 0; l=[]
for c in s:
    if c in acgt:
        x += 1
    else:
        l.append(x)
        x = 0
l.append(x)
print(max(l))

Solution (Python):
s = input()
s_0 = s[:]
s_0 = s_0.replace('A', '.').replace('G', '.').replace('C', '.').replace('T', '.')
count = 0
ans = 0

for i in range(len(s_0)):
    if s_0[i] == '.':
        count += 1
        if ans < count:
            ans = count
    else:
        count = 0

print(ans)

Solution (Python):
s=input()
a=[1 if x=="A" or x=="C" or x=="G" or x=="T" else 0 for x in s]
b=[0]*len(s)
c=0
for i in range(len(a)-1):
    if a[i]==1 and a[i+1]==1:
        c+=1
        b[i]=c
    else:
        c=0
print(max(b)+1 if 1 in a else 0)

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

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