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



a = input()


o = 0



for i in range(len(a)):
    if a[i] in ('A', 'C', 'G', 'T'):
        t = 1
        for j in range(i+1, len(a)):
            if a[j] in ('A', 'C', 'G', 'T'):
                t += 1
                
               
               
            else:
               
               
                break
        if o < t:
            o = t


print(o)

Solution (Python):
import re

s = input()

ACGT = re.compile(r'[ACGT]+')
a = ACGT.findall(s)

ml = 0
for i in a:
    if len(i) > ml:
        ml = len(i)

print(ml)

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

Solution (Python):
str = input()
max_cnt = 0
cnt = 0
for s in str:
  if "ACGT".find(s) >= 0:
    cnt += 1
  else:
    if max_cnt < cnt:
      max_cnt = cnt
    cnt = 0

print(max(cnt,max_cnt))

Solution (Python):
s = input()

cnt , mx = 0, 0
for i in s:
    if i == 'A' or i== 'T' or i == 'C' or i == 'G':
        cnt += 1
        mx = max(mx,cnt)
    else:
        cnt = 0

print(mx)

Solution (Python):

Str = input()

ans = [0]
count = 0
for s in Str:
    if s in "AGCT":
        count += 1
        ans.append(count)
    if count > 0 and s not in "AGCT":
        count = 0

print(max(ans))

Solution (Python):
S = str(input())
res = 0
temp = 0

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

Solution (Python):
n = input()
max_count = 0
count = 0
for i in n:
    if i in "ATCG":
        count += 1
        max_count = max(max_count, count)
    else:
        count = 0
print(max_count)

Solution (Python):
li = input()

s = 0
ds = 0
for v in li:
  if (v == 'A' or v =='T' or v=='G' or v=='C' ):
    ds+=1
  else:
    ds=0
  s = max(s,ds)
print (s)

Solution (Python):
import re
s = input()
m = re.findall(r"([ACGT]+)",s)
print(len(max(m,key=len)) if m else 0)

Solution (Python):
S = input()

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


print(max_length)

Solution (Python):
S = input()
res = 0
temp = 0

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

print(res)

Solution (Python):
S=list(input())
Count=[]
for i in range(len(S)):
    if S[i] in ['A','C','T','G']:
        Count.append(1)
    else:
        Count.append(0)
c=0
m=[]
for i in range(len(S)):
    if Count[i]==1:
        c+=1
        m.append(c)
        continue
    else:
        c*=0
        m.append(c)
        continue


print(max(m))

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

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

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

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

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()
s_list = list(S)

acgt = list("ACGT")

max_length = 0
max_length_bottom = 0

tmp_length = 0
for i, s in enumerate(s_list):
    if s in acgt:
        tmp_length += 1
    if tmp_length > max_length:
        max_length = tmp_length

    if s not in acgt:
        tmp_length = 0
        
print(max_length)

Solution (Python):
import re

S = input()

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

if matchall:
    print(max(map(len,matchall)))
else:
    print('0')

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

ans = 0
counter = 0
for i in range(L):
    if S[i] == 'A' or S[i] == 'T' or S[i] == 'G' or S[i] == 'C':
        counter += 1
    else:
        if ans < counter:
            ans = counter
        counter = 0

if ans < counter:
    ans = counter
    
print(ans)

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

for k in range(len(S)):
    for i in range(1,len(S)+1-k):
        moji = ""
        check = True
        for j in range(i):
            
            if not check:
                break
            if S[j+k] == "A" or S[j+k] == "T" or S[j+k] == "C" or S[j+k] == "G":
                moji += S[j+k]
            else:
                check = False
        
        l.append(len(moji))
        
        
print(max(l))

Solution (Python):
S = input()

length = 0
longest = 0

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

for i in range(len(S)):
    if S[i] in agct:
        length += 1
        if length > longest:
            longest = length
    else:
        length = 0

print(longest)

Solution (Python):
s = [i for i in input()]
ans = 0
tmp = 0
acgt = ['A', 'C', 'G', 'T']
while s:
  if s.pop(0) in acgt:
    tmp += 1
  else:
    ans = max([ans, tmp])
    tmp = 0

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

Solution (Python):


def main():
    s = str(input())
    slist = list(s)

    stk = []
    c = []
    lenmax = 0
    for i in range(len(slist)):
        if slist[i] == 'A' or slist[i] =='C' or slist[i] =='G' or slist[i] =='T':
            stk.append(slist[i])
            if i == len(slist) - 1:
                c.append(stk)
        else:
            c.append(stk)
            if len(stk) > 0:
                stk = []
                c.append(stk)
            stk = []



    for j in range(len(c)):
        if len(c[j]) > lenmax:
            lenmax = len(c[j])

    print(lenmax)
if __name__ == "__main__":
    main()

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

Solution (Python):
import re

S = input()
pattern = "[ATGC]*"

matched_list = sorted(re.findall(pattern, S), key=len, reverse=True)
print(len(matched_list[0]))

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

Solution (Python):
import re

S = input()
pattern = "[ATGC]*"

matched_list = sorted(re.findall(pattern, S),
                      key=lambda s: len(s),
                      reverse=True)
print(len(matched_list[0]))

Solution (Python):
S = input()

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

Solution (Python):
s = input()

count = 0
m = 0

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

Solution (Python):


import re

def main():
    s = input()
    substrs = re.split('[^ACGT]', s)
    print(max(list(map(len, substrs))))


if __name__ == '__main__':
    main()

Solution (Python):
def main():
  S = input()
  acgts = ['']
  for b in range(len(S)):
    for e in range(b + 1, len(S) + 1):
      span = S[b:e]
      if not span.replace('A', '').replace('G', '').replace('C', '').replace('T', ''):
        acgts.append(span)
  print(max([len(x) for x in acgts]))


if __name__ == "__main__":
  main()

Solution (Python):
s = input()
V = [s[j] for j in range(0,len(s))]
countG = 0
countL = 0
for j in range(0,len(s)):
	if s[j] != 'A' and s[j] != 'T' and s[j] != 'C' and s[j] != 'G':
		countL = 0
	else:
		countL = countL + 1
	countG = max([countG,countL]) 
print(countG)

Solution (Python):
ex = input()
a = ex.replace('A','*')
b = a.replace('T','*')
c = b.replace('G','*')
d = c.replace('C','*')
ans = 0
for i in range(10):
    if '*'*(i+1) in d:
        ans = i+1
print(ans)

Solution (Python):
S = input()

counter = 0
pib = 0
for i in S:
    if i in 'AGCT':
        counter += 1
    else:
        counter = 0
    if pib < counter:
        pib = counter
print(pib)

Solution (Python):

S = input()
ARR = ['A', 'C', 'G', 'T']

results = []
count = 0
for i in range(len(S)):
    if S[i] in ARR:
        count+=1
        results.append(count)
    else:
        results.append(count)
        count = 0

print(max(results))

Solution (Python):
import re
s=input()
s1=re.sub(r'[BD-FH-SU-Z]','*',s)
s2=s1.split('*')
l1=[len(s2[i]) for i in range(len(s2))]
print(max(l1))

Solution (Python):
S = input()


def is_acgt(c):
    return c == 'A' or c == 'C' or c == 'G' or c == 'T'


succession = 0
max_succession = 0
for c in S:
    if is_acgt(c):
        succession += 1
    else:
        max_succession = max(succession, max_succession)
        succession = 0
print(max(succession, max_succession))

Solution (Python):
import re
s=input()
s1=re.sub(r'[BD-FH-SU-Z]','*',s)
s2=s1.split('*')
l1=[len(s2[i]) for i in range(len(s2))]
print(max(l1))

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

s = list(input().strip())
l = []

b = ""
for v in s:
    if v in ["A", "G", "C", "T"]:
        b += v
    else:
        l.append(b)
        b = ""
l.append(b)

print(max([len(v) for v in l]))

Solution (Python):
import re

print(max(map(len, re.split("[^ACGT]", input()))))

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

ans = 0
lians = []
for i in range(n):
  if li[i] == "A" or li[i] =="G" or li[i] =="C" or li[i] =="T":
    ans += 1
  else:
    lians.append(ans)
    ans = 0
lians.append(ans)
print(max(lians))

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

Solution (Python):


from bisect import bisect_left as binl

def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return map(int, input_tuple)


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x





def main():
    s = input()
    acgt = ['A', 'C', 'G', 'T']

    count = 0
    max_count = 0
    for i in s:
        if i in acgt:
            count += 1
            max_count = max(count, max_count)
        else:
            count = 0

    print(max_count)


if __name__ == '__main__':
    main()

Solution (Python):

S=input().replace("A","a").replace("T","t").replace("C","c").replace("G","g")


import re
list=re.findall(r"[a-z]+",S)


list2=[]
for i in range(len(list)):
  list2.append(len(list[i]))
  

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

Solution (Python):

s = input()
s += 'X'
here = 0
res = -100

for c in s:
    counter = 0
    char = c
    while char == 'A' or char == 'C' or char == 'G' or char == 'T':
        counter += 1
        char = s[here + counter]
    if counter > res:
        res = counter
    here += 1

print(res)

Solution (Python):
S = str(input())+"_"
cnt, ans = 0, 0
acgt = set(["A","T","G","C"])
for i in range(len(S)):
    if S[i] not in acgt:
        ans=max(ans, cnt)
        cnt=0
    else:
        cnt+=1
print(ans)

Solution (Python):
item=list(input())
result=0
sign=0
search=['A','C','G','T']
for i in range(len(item)):
    if item[i] in search:
        sign=sign+1
        continue
    if sign>result:
        result=sign
        sign=0
if sign>result:
    result=sign
print(result)

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

Solution (Python):
S = input()
N = len(S)
ans = 0
for l in range(N):
    for r in range(l+1, N+1):
        T = S[l:r]
        ok = True
        for c in T:
            if c not in 'ACGT':
                ok = False
                break
        if ok:
            ans = max(ans, r-l)
print(ans)

Solution (Python):
S = input()
count = 0
max = 0
atcg = ('A', 'T', 'C', 'G')

for i in range(len(S)):
  if S[i] in atcg:
    count += 1
    if max < count:
        max = count
  else:
    count = 0
    
print(max)

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

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

Solution (Python):
S = input()
listS = []
for i in range(len(S)):
  listS.append(S[i])
  

def check_ACGT(array):
  cnt = 0
  for i, elm in enumerate(array):
    if elm not in ["A", "C", "G", "T"]:
      cnt += 1
  return True if cnt == 0 else False

ans = 0
for i in range(len(listS)):
  for j in range(len(listS)):
    if i<j+1:
      sublistS = listS[i:(j+1)]
      if check_ACGT(sublistS) and ans < len(sublistS):
        ans = len(sublistS)

print(ans)

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

Solution (Python):
a = input()

b = 'ACGT'
ans =0
for i in a:
    now = 0
    for j in a:
        if j in b:
            now += 1
            ans = max(ans,now)
        else:
            now=0
print(ans)

Solution (Python):
s = input()
l = 'ACGT'
ans = 0
most = 0
for i in s:
    if i in l:ans+=1
    else:ans=0
    if ans > most:most=ans
print(most)

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

count = 0
list_count = []
for s in S:
    if s == 'A' or s == 'T' or s == 'C' or s == 'G':
        count += 1
        list_count.append(count)
    else:
        count = 0

if len(list_count) == 0:
    print('0')
else:
    print(max(list_count))

Solution (Python):
import re;s=input();m=[len(p.group(0))for p in re.finditer('[ACGT]+',s)];print(max(m+[0]))

Solution (Python):
S=input()
n=len(S)
l='ACTG'
ans=0
for i in range(0,n+1):
  for j in range(i,n+1):
    a=S[i:j]
    if set(l)>=set(a):
      ans=max(ans,len(a))
print(ans)

Solution (Python):
S=input()
n=len(S)
l='ACTG'
ans=0
for i in range(0,n):
  for j in range(i,n+1):
    a=S[i:j]
    if set(l)>=set(a):
      ans=max(ans,len(a))
print(ans)

Solution (Python):
b=str(input())
setb=['A','T','C','G']
lenmax=0
lenmaxlist=[]
for i in range(len(b)):
    if b[i] in setb:
        lenmax=lenmax+1;
    else:
        lenmaxlist.append(lenmax)
        lenmax=0
if lenmax>0:
    lenmaxlist.append(lenmax)
if lenmaxlist:
    print(max(lenmaxlist))
else:
    print(0)

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

print(ans)

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

for i in b:
    if i in "ACTG":
        cnt+=1
    else:
        ans.append(cnt)
        cnt = 0

ans.append(cnt)

print(max(ans))

Solution (Python):

import sys


def solve(S: str):
    longest = 0
    count = 0
    for s in S:
        if s in ['A','T','G','C']:
            count += 1
        else:
            count = 0
        if count > longest:
            longest = count
    print(longest)
    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()
ls = list(S)
ans = 0
for i in range(len(ls)):
    cnt = 0
    for j in range(i,len(ls)):
        if S[j] in ['A','T','C','G']:
            cnt += 1
            if j == len(ls) - 1:
                ans = max(ans,cnt)
        else:
            ans = max(ans,cnt)
            break
print(ans)

Solution (Python):
import copy
ls=list(input())
ans=0

ans_ls=[]

for i in range(len(ls)):
    if ls[i]=='A' or ls[i] == 'C' or ls[i] == 'G' or ls[i] == 'T':
        ans=ans+1
        
    else:
        
        ans1=ans
        
        ans_ls.append(ans1)
        ans=0
ans_ls.append(ans)

print(max(ans_ls))

Solution (Python):
j = 0
i = 0
count = 0
max_count = 0
b = input()

b = b.replace('A','*')
b = b.replace('T','*')
b = b.replace('G','*')
b = b.replace('C','*')

while i < len(b):
    if b[i] == "*":
        while i + j < len(b):
            if b[i+j] == "*":
                count += 1
                j += 1
            else:
                i = i + j
                j = 0
                break
        if count >= max_count:
            max_count = count
            count = 0
    i += 1
    
print(max_count)

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

Solution (Python):
s = input()

s_len = len(s)
acgt_len = 0
chg_flag = 0
cnt_buf = 0
cnt = 0
for i in range(len(s)):
    if s[i] in ["A", "C", "G", "T"]:
        cnt += 1
    elif cnt_buf <= cnt:
        cnt_buf = cnt
        cnt = 0
    else:
        cnt = 0

if cnt_buf <= cnt:
    acgt_len = cnt
else:
    acgt_len = cnt_buf

print(acgt_len)

Solution (Python):
S=input()
max=0
cnt=0
key=False
li=['A','C','G','T']
for i in S:
    for j in li:
        if i==j:
            key=True
            cnt+=1
            if max<cnt:
                max=cnt
            break
        else:
            key=False
    if key==False:
        cnt=0
print(max)

Solution (Python):
import re
s=input()
r=[0]
for i in re.finditer("[ACGT]+", s):
    r.append(len(i.group()))
print(max(r))

Solution (Python):
s=input()
len=0
ans=0
for c in s:
    if c in "AGCT":
        len+=1
        ans=max(ans,len)
    else:
        len=0
print(ans)

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

Solution (Python):
s=input()
res=[]
for i in range(len(s)):
    for j in range(i,len(s)+1):
        t=s[i:j]
        if all([k in ["A","T","G","C"] for k in list(t)]):
            res.append(len(t))
print(max(res))

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

for i in S:
    if ('A' in i) or ('C' in i) or ('G' in i) or ('T' in i):
        atgc[n] += 1
    else:
        n += 1
        
ans = max(atgc)
print(ans)

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

Solution (Python):


def solve():
    S = input()

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


if __name__ == "__main__":
    solve()

Solution (Python):
S=input()
ct=0
max=0
for s in S:
  if s=='A' or s=='T' or s=='G' or s=='C':
    ct+=1
    if ct > max:
      max=ct
  else:
    ct=0
print(max)

Solution (Python):
s=input()
s_2=[1 if s[i]=="A" or s[i]=="C" or s[i]=="G" or s[i]=="T" else 0 for i in range(len(s))]
s_3=0
for j in range(len(s)):
    s_3+=s_2[j]*(10**j)
s_3=str(s_3)
ans=0
for k in range(len(s)+1):
    if "1"*k in s_3:
        ans=k
print(ans)

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

Solution (Python):
import re
regex=(r'[A|C|G|T]+')
s=input()
mo=re.findall(regex,s)
print(len(max(mo,key=len)) if mo!=[] else 0)

Solution (Python):
import sys
import numpy as np

readInt = lambda: int(sys.stdin.readline())
readIntN = lambda: [int(v) for v in sys.stdin.readline().split(' ')]

s = input()

i = 0
j = 0
ret = 0
while i < len(s):
    while j < len(s) and s[j] in "ACGT":
        j += 1
    ret = max(ret, j - i)
    j += 1
    i = j
print(ret)

Solution (Python):
S = str(input())
A = 'ACGT'
L = len(S)

cnt = 0
max_cnt = 0
for x in S:
    if x in A:
        cnt += 1
    else:
        if max_cnt < cnt:
            max_cnt = cnt
        cnt = 0
if max_cnt < cnt:
    max_cnt = cnt

print(max_cnt)

Solution (Python):
x=input()
N=len(x)
maxl=0
for i in range(N):
  if (x[i]=="A")or(x[i]=="T")or(x[i]=="G")or(x[i]=="C"):
    j=1
    while (i+j<N):
      if ((x[i+j]=="A")or(x[i+j]=="T")or(x[i+j]=="G")or(x[i+j]=="C")):
        j=j+1
      else:
        break
    if maxl<j:
      maxl=j
      maxi=i
    
print(maxl)

Solution (Python):
s = input().strip()

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

max_len, i = 0, 0

while i < len(s):
    if s[i] in ok_list:
        l = 0
        while i < len(s) and s[i] in ok_list:
            i += 1
            l += 1

        if l > max_len:
            max_len = l

    else:
         i += 1

print(max_len)

Solution (Python):
c = list(input())
ans = 0
for i in range(len(c)):
    j = i
    count = 0
    judge = True
    while judge and j <= len(c)-1:
        
        if ((c[j] == "A") or (c[j] == "C") or (c[j] == "G") or (c[j] == "T")):
            judge = True
            count += 1
            j += 1
        else:
            judge = False
    ans = max(ans,count)
print(ans)

Solution (Python):
S = input()
L = ["A","C","G","T"]
ans = 0
for i in range(len(S)):
  for j in range(i+1,len(S)+1):
    s = S[i:j]
    ok = True
    for c in s:
      if not c in L:
        ok = False
    if ok:
      ans = max(ans,j-i)
print(ans)

Solution (Python):
S = input()
acgt_tmp = 0
acgt_max = 0

for s in S+'$':
  if s in ['A','C','G','T']:
    acgt_tmp += 1
  else:
    if acgt_tmp>acgt_max:
      acgt_max = acgt_tmp
    acgt_tmp = 0

print(acgt_max)

Solution (Python):
s=0
n=0
for i in list(input()):
  if i in {'A','T','C','G'}:
    n+=1
  else:
    n=0
  s=max(s,n)
print(s)

Solution (Python):
a=input()
b="ACGT"
c=d=0
for i in range((len(a))):
    if a[i] in b:
        c+=1
    else:
        c=0
    d=max(c,d)
print(d)

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

Solution (Python):
A = 'ATGC'
 
S = input()
leng = 0
k = 0
 
for s in S:
  if s in A:
    k += 1
  else:
    if k > leng:
      leng = k
      k = 0
      
print(max(k, leng))

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

for i in range(len(s)):
  for j in range(len(s) - i):
    s1 = s[i:len(s) - j]
    flag = 1
    for k in range(len(s1)):
      if s1[k] != "A" and s1[k] != "C" and s1[k] != "G" and s1[k] != "T":
        flag = 0
        break
    if flag == 1 and len(s1) > ans:
      ans = len(s1)
print(ans)

Solution (Python):


S = list(input())
clst=[]
count = 0
for s in S:
    if s == 'A' or s == 'T' or s =='C' or s == 'G':
        count += 1
        clst.append(count)
    else:
        
        count = 0
        clst.append(count)
print(max(clst))

Solution (Python):
s = list(input())
len = 0
max_len = 0
for str in s:
    if str in ["A", "C", "G", "T"]:
        len += 1
    else:
        if len > max_len:
            max_len = len
        len = 0
else:
    if len > max_len:
        max_len = len
print(max_len)

Solution (Python):
def judge(ch):
    if ch in "ACGT":
        return True
    else:
        return False


s = input()
ans, tmp = 0, 0
for ch in s:
    if judge(ch):
        tmp += 1
    else:
        tmp = 0
    ans = max(ans, tmp)
print(ans)

Solution (Python):
import re
a = re.sub('[^ACGT]+',' ',input()).split()
len_list = [len(x) for x in a]
if not len_list:
  print('0')
else:
  print(max(len_list))

Solution (Python):
S=set(["A","C","G","T"])
L=list(input())
A=[]
M=0
for i in L :
  if i in S :
    M+=1
  else :
    A.append(M)
    M=0
A.append(M)
print(max(A))

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

Solution (Python):

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

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

Solution (Python):
S = str(input())
lists = []
result = []
max = 0
for i in range(len(S)):
    for j in range(len(S)):
        result.append(S[i:len(S) - j])
for i in range(len(result)):
    cnt = 0
    for j in range(len(result[i])):
        m = list(result[i])
        if m[j] == "A" or m[j] == "C" or m[j] == "G" or m[j] == "T":
            cnt += 1
    if cnt == len(result[i]):
        lists.append(result[i])
        if max < len(result[i]):
            max = len(result[i])
print(max)

Solution (Python):
S = input()

slist = []
s = ''
for i in range(len(S)):
    if S[i] in 'ATGC':
        s += S[i]
    else:
        slist.append(s)
        s = ''
if S[-1] in 'ATGC':
    slist.append(s)

lenlist = [len(slist[i]) for i in range(len(slist))]
print(max(lenlist))

Solution (Python):
import re


s = input()
print(max(map(len,re.sub(r'[^ATCG]', ' ',s).split(' '))))

Solution (Python):
s = input()
ss = ""
for i in range(len(s)):
    if s[i] not in ["A", "T", "G", "C"]:
        ss += " "
    else:
        ss += s[i]
l = ss.split()

m = 0
for ll in l:
    if (len(ll)) > m:
        m = len(ll)
print(m)

Solution (Python):
S = input()

ACGT = "ACGT"

i = 0

result = 0

while i < len(S):
    while i < len(S) and S[i] not in ACGT:
        i += 1
    st = i
    while i < len(S) and S[i] in ACGT:
        i += 1
    result = max(result, i - st)

print(result)

Solution (Python):
b = input()

tmp = 0
total = 0
for i in b :
    if i == 'A' or i == 'C' or i == 'G' or i == 'T':
        tmp += 1
        total = max(total,tmp)
    else:
        total = max(total,tmp)
        tmp = 0

print(total)

Solution (Python):
s= input()

chars = list(s)

s1 = ''
s2 = ''

for c in chars:

  if c in 'ACGT':
    s2 += c
  else:
    if len(s2) >= len(s1):
      s1 = s2
      s2 = ''

if len(s2) >= len(s1):
  print(len(s2))
else:
  print(len(s1))

Solution (Python):
a = input()
count = 0
ans = 0
for i in a:
    if i != "A" and i != "G" and i != "C" and i != "T":
        count = 0
    else:
        count += 1
        if ans <= count:
            ans = count
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 ans < count:
			ans = count
	else:
		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 ans < count:
			ans = count
	else:
		count = 0
print(ans)

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

Solution (Python):
src = input()
length = len(src)
acgt = set("ACGT")
ans = 0
for i in range(length):
    n = length - i
    for ngram in [src[k:k+n] for k in range(length - n + 1)]:
        subtract = len(set(ngram) - acgt)
        if subtract == 0:
            ans = n
            break
    if ans != 0:
        break
print(ans)

Solution (Python):
s =input()

c = 0
m = 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
      if c >= m:
        m = c
  else:
    c = 0
print(m)

Solution (Python):
s = input()
n = len(s)
a = "BDEFHIJKLMNOPQRSUVWXYZ"
cnt = []
for i in range(0, n):
    for j in range(i,n+1):
    	fr = s[i:j]
    	value = 1
    	for k in a:
    		if k in fr:
    			value = 0
    	if value:
    		cnt.append(len(fr))
    		
print(max(cnt))

Solution (Python):
S = str(input())
ans = 0
count =0
i = 0
j = 1

while i <= len(S):
    j = i + 1
    while j <= (len(S)+1):

        s = S[j-1:j]


        if j == len(S) + 1:
            if s == 'A' or s == 'C' or s == 'G' or s == 'T':
                count += 1
                ans = max(ans, count)

                count = 0

            else:
                ans = max(ans, count)

                count = 0

        else:
            if s == 'A' or s == 'C' or s == 'G' or s == 'T':
                count += 1


            else:
                ans = max(ans, count)
                count = 0
                j = len(S) + 2

                
        j += 1
    i += 1
print (ans)

Solution (Python):
S = input()
cnt = 0
t_cnt = 0
for x in S:
    if x in ['A', 'C', 'G', 'T']:
        t_cnt += 1
        if t_cnt > cnt:
            cnt = t_cnt
    else:
        t_cnt = 0
print(cnt)

Solution (Python):
sentence = input()

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

Solution (Python):
sentence = input()


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

print(maxcount)

Solution (Python):
def resolve():
    acgt = 'ACGT'
    S = input()

    cnt = 0
    max_cnt = 0
    for s in S:
        if s in acgt:
            cnt += 1
            max_cnt = max(max_cnt, cnt)
        else:
            cnt = 0
            
    print(max_cnt)
  
resolve()

Solution (Python):
S = input()



ATGC = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}

max = 0
cnt = 0
for i in S:
    if i in ATGC:
       cnt += 1
    else:
        cnt = 0

    if max < cnt:
        max = cnt
print(max)

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