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

m_len=0
len=0

acgt={'A','C','G','T'}

for i in S:
    if i in acgt:
        len+=1
        
    else:
        
        if len>m_len:
            m_len=len
        len=0
        
if len>m_len:
    m_len=len

print(m_len)

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

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

print(ans)

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

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

Solution (Python):
import sys
input = sys.stdin.readline
tuples = ("A", "C", "G", "T")
def print_ans(B):
    """Test Case
    >>> print_ans("ATCODER")
    3
    >>> print_ans("HATAGAYA")
    5
    >>> print_ans("SHINJUKU")
    0
    """
    max_len = 0
    tmp = 0
    for b in B:
        if b in tuples:
            tmp += 1
            max_len = max(max_len, tmp)
        else:
            tmp = 0
    print(max_len)

    

if __name__ == '__main__':
    B = input().rstrip()
    print_ans(B)

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

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

ans = 0
c = 0
for s in S:
    if s in t:
        c += 1
    else:
        c = 0
    ans = max(ans, c)
print(ans)

Solution (Python):
s = list(input())
cheack = ['A','C','G','T']
counter,max_lenge = 0,0
for char in s:
  if char in cheack:
    counter += 1
    if counter > max_lenge:
      max_lenge = counter
  else:
    counter = 0
print(max_lenge)

Solution (Python):
def inpl(): return list(map(int, input().split()))
S = input()
C = set("ACGT")

tmp = 0
ans = 0

for s in S:
    if s in C:
        tmp += 1
    else:
        ans = max(ans, tmp)
        tmp = 0
ans = max(ans, tmp)
print(ans)

Solution (Python):
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

S = list(input())
N = len(S)
tmp = ["A","G","C","T"]
ans = 0
for s in range(N):
    for t in range(s,N+1):
        
        flag = True
        for x in S[s:t]:
            if x not in tmp:
                flag = False

        if flag:
            ans = max(ans,t-s)


print(ans)

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

Solution (Python):
s = input()

m = 0
count = 0

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

m = max(count, m)
count = 0

print(m)

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

enki = set(["A", "C", "G", "T"])
cnt = 0
cntmax = 0
for i in a:
  if i in enki:
    cnt += 1
  else:
    if cntmax < cnt:
      cntmax = cnt
    cnt = 0
if cntmax < cnt:
  cntmax = cnt

print(cntmax)

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

count = 0
maxi = 0
for i in s:
    if i in acgt:
        count += 1
        if count > maxi:
            maxi = count
    else:
        count = 0
print(maxi)

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

Solution (Python):
S = input()
N = len(S)
L = [0 for i in range(N + 1)]
R = [0 for i in range(N + 1)]

t = 'ACGT'

cnt = 0
for i in range(N):
    if S[i] in t:
        cnt += 1
    else:
        cnt = 0
    L[i] = cnt
cnt = 0
for i in range(N - 1, -1, -1):
    if S[i] in t:
        cnt += 1
    else:
        cnt = 0
    R[i] = cnt

ans = L[0]
for i in range(1, N):
    ans = max(ans, L[i - 1] + R[i])

print(ans)

Solution (Python):
S = input()

t = ''.join(c if c in 'ACGT' else ' ' for c in S)
print(max(map(len, t.split(' '))))

Solution (Python):
ls_s = [_ for _ in input()]

cnt = 0
cmax = 0

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

Solution (Python):
import sys

def main():
    s = sys.stdin.readline().rstrip()
    
    ATCG = set('ATCG')
    res = 0
    cnt = 0
    for char in s:
        if char in ATCG:
            cnt += 1
        else:
            res = max(res, cnt)
            cnt = 0
    res = max(res, cnt)

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

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

Solution (Python):
s = input()

ans = 0
cnt = 0

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

        
ans = max(ans, cnt)
print(ans)

Solution (Python):
import re


def main(s: str):
    length = [len(_s) for _s in re.findall(r'[ACGT]+', s)]

    if length == []:
        print(0)
        return

    print(max(length))


if __name__ == '__main__':
    s = input()

    main(s)

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

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

def func(a):
    return True if a!='' else False

for start in range(len(S)):
    for end in range(0,len(S)):
       l.append(S[start:end+1])

l = list(filter(func,l))

o=[]
r=[]
for m in l:
    for n in m:
        if n!='A' and n!='C' and n!='G' and n!='T':
            o.append(m)
            break

for p in o:
    l.remove(p)

for q in l:
    r.append(len(q))


if len(r)==0:
    print(0)
else:
    print(max(r))

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

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

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

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

Solution (Python):
s = input()

length = 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':
		length = length + 1
		ans = max ( ans , length )
	else:
		length = 0

print(ans)

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

Solution (Python):
S = input()
S += "_"

res = 0
cnt = 0
for s in S:
    if s in "ACGT":
        cnt += 1
    else:
        res = max(res, cnt)
        cnt = 0

print(res)

Solution (Python):
max_num = 0
num = 0
for c in input():
    if c in {"A", "C", "G", "T"}:
        num += 1
    else:
        max_num = max(max_num, num)
        num = 0
max_num = max(max_num, num)
print(max_num)

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

Solution (Python):
s=input()
def c(b):
  return b=='A' or b=='G' or b=='T' or b=='C'

suc=[]
ct=0
for let in s:
  if c(let):
    ct+=1
  else:
    suc.append(ct)
    ct=0
suc.append(ct)
print(max(suc))

Solution (Python):
S = list(input())
s = ["A", "T", "G", "C"]
for i in range(len(S)):
    if S[i] not in s:
        S[i] = "takayg"
S = ''.join(S)
S = S.split("takayg")
ans = []
for i in S:
    ans.append(len(i))
print(max(ans))

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

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

Solution (Python):
s = input()
b = 'ACGT'
a = t = 0

for c in s:
    if c in b:
        t += 1
    else:
        a = max(a, t)
        t = 0

print(max(a, t))

Solution (Python):
import re
s = input()
pattern = "[ATGC]+"

result = re.finditer(pattern, s)

lens = [len(res.group()) for res in result]
if len(lens)==0:
  ret=0
else:
  ret=max(lens)
print(ret)

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

atcg = ["A","T","C","G"]
ans = [0]*n
if s[0] in atcg:
    ans[0] += 1
    
for i in range(1,n):
    if s[i] in atcg:
        ans[i] += ans[i-1] + 1
        
print(max(ans))

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

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

Solution (Python):

s = input()
acgt = 'ACGT'

length = 0
max_length = 0

for i in range(len(s)):
    if s[i] in acgt:
        for j in range(len(s) - i):
            if s[i + j] in acgt:
                length += 1
            else:
                break

        max_length = max(max_length, length)
        length = 0

print(max_length)

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

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

tmp = 0
cnt = 0
for i in s:
    if i in (at):
        tmp+=1
    else:
        if cnt < tmp:
            cnt = tmp
        tmp = 0
if cnt < tmp:
    cnt = tmp
            
print(cnt)

Solution (Python):
S = input()
a = ["A", "C", "G", "T"]
ans = 0
count = 0
for i in S:
  if i in a:
    count += 1
  elif ans < count:
    ans = count
    count = 0

if count != 0:
  if ans < count:
    ans = count

print(ans)

Solution (Python):
s = input()

cnt = 0
maxc = 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:
    cnt = 0

  if maxc < cnt:
    maxc = cnt

print(maxc)

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

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

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

Solution (Python):
import re
S = input()
pattern = '[AGCT]+'
print(max(map(len, re.findall(pattern, S)), default=0))

Solution (Python):
s = list(input())
i = 0
ans = []
while i < len(s):
    count = 0
    while s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T" :
        count += 1
        i += 1
        if i >= len(s):
            break
    ans.append(count)
    i += 1
print(max(ans))

Solution (Python):

import sys










def main():
    s = sys.stdin.readline().rstrip()
    
    permitted = 'ACGT'
    continuous_count = []
    count = 0

    for i in range(len(s)):
        char = s[i]
        if char in permitted:
            count += 1
        else:
            continuous_count.append(count)
            count = 0
        if i == len(s) - 1:
            continuous_count.append(count)
    
    if not continuous_count:
        print(len(s))
    else:
        print(max(continuous_count))



if __name__ == "__main__":
    main()

Solution (Python):

import sys




import itertools





def main():
    s = sys.stdin.readline().rstrip()
    
    all_words = []
    for i in range(1, len(s) + 1):
        for letters in itertools.product('ATCG', repeat=i):
            word = ''.join(letters)
            all_words.append(word)
    
    for i in range(len(all_words)-1, 0-1, -1):
        if all_words[i] in s:
            print(len(all_words[i]))
            sys.exit()
    print(0)




if __name__ == "__main__":
    main()

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

Solution (Python):
s=list(str(input()))
li=["A","C","G","T"]
ans=0
x=[0]
for i in range(0,len(s)):
  if s[i] in li:
    ans+=1
    x.append(ans)
  else:
    ans=0
        
print(max(x))

Solution (Python):
print(max(map(lambda x:len(x), "".join([_ if _ in "ACGT" else "_" for _ in str(input())]).split("_"))))

Solution (Python):
print(max([len(_) for _ in "".join([_ if _ in "ACGT" else "_" for _ in str(input())]).split("_")]))

Solution (Python):
S = str(input())
tmp = S.replace('A', '_').replace('T','_').replace('G','_').replace('C','_')

for i in range(len(tmp)):
    if tmp[i] != '_':
        S = S.replace(S[i], '_')
print(max([len(x) for x in S.split('_')]))

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

ans = 0
now = 0
for i in b:
    if i in ["A", "C","G","T"]:
        now += 1
        if now > ans:
            ans = now
    else:
        now = 0
        
print(ans)

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

def main():
    S = input().strip()
    ma = 0
    ACGT = ['A', 'C', 'G', 'T']
    count = 0
    for s in S:
        if s in ACGT:
            count += 1
        else:
            ma = max(ma, count)
            count = 0
    ma = max(ma, count)
    print(ma)


if __name__ == '__main__':
    main()

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

Solution (Python):
s=input()
count=0
ans=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
  else:
    if ans<count:
      ans=count
    count=0
if ans<count:
      ans=count
print(ans)

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

Solution (Python):
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

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

S=one_str()

count=0
max_count=0
for s in S:
    if s in ["A","G","C","T"]:
        count+=1
    else:
        if max_count < count:
            max_count = count
        count=0
if max_count < count:
    max_count=count
print(max_count)

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

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

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

Solution (Python):
acgt = ['A', 'C', 'G', 'T']

s = list(input())

tmp = 0
ans = 0

for i in range(len(s)) :
    if acgt.count(s[i]) == 1 :
        tmp += 1
    else :
        tmp = 0
    
    if tmp > ans :
        ans = tmp

print(ans)

Solution (Python):
S = list(input())
ACGT = ['A','C','G','T']
 
tans = 0
ans = 0
 
for i in range(len(S)):
  if S[i] in ACGT:
    tans += 1 
    if ans < tans:
        ans = tans
  else:
    tans = 0


print(ans)

Solution (Python):
s = list(str(input()))
info = []
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
        info.append(cnt)
    else:
        cnt = 0
        info.append(cnt)
print(max(info))

Solution (Python):

import numpy as np
S = input()
n = len(S)
l = np.zeros(n, dtype=int)
DNA = ['A', 'G', 'C', 'T']

if S[0] in DNA:
  ll = [1]
else:
  ll = [0]

for i in range(1, n):
  if S[i] in DNA:
    ll.append(ll[i-1]+1)
  else:
    ll.append(0)

print(max(ll))

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

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

Solution (Python):
S = input()

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

    if length > max_length:
      max_length = length

print(max_length)

Solution (Python):
s = input()

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

print(ans)

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

    array = ['A', 'C', 'G', 'T']
    count = 0
    ans = 0
    for i in range(len(S)):
        if S[i]!=array[0] and S[i]!=array[1] and S[i]!=array[2] and S[i]!=array[3]:
            ans = max(ans, count)
            count = 0
        else:
            count += 1

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


if __name__ == '__main__':
    main()

Solution (Python):
s=input()
l=['A','C','G','T']
len_s=[]
count=0
for i in range(len(s)):
    if s[i] in l and i!=len(s)-1:
        count+=1
    elif s[i] not in l:
        len_s+=[count]
        count=0
    else:
        count+=1
        len_s+=[count]
print(max(len_s))

Solution (Python):
S = input()

count_list = []
for i in S:
    if i == 'A' or i == 'C' or i == 'G' or i == 'T':
        count_list.append(True)
    else:
        count_list.append(False)

l = len(S)
freq_list = []
for i in range(l):
    count = 0
    for j in range(l-i):
        if count_list[i+j] is True:
            count += 1
            freq_list.append(count)
        else:
            freq_list.append(count)
            break

print(max(freq_list))

Solution (Python):
from collections import Counter,defaultdict,deque
import sys,bisect,math,itertools,string,queue
from heapq import heappop, heappush
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

s = input()
acgt = {'A', 'C', 'G', 'T'}
cnt = 0
res = 0
for i,t in enumerate(s):
    if t in acgt:
        cnt += 1
    else:
        cnt = 0
    res = max(res, cnt)
print(res)

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

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

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

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

for e in s:
    if e in "ACGT":
        cnt += 1
    else:
        if cnt > ans:
            ans = cnt
        cnt = 0

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

Solution (Python):
T = input()+"Z"  
x=["A","C","G","T"]
count=0
stock=[]

for i in range(len(T)):
  if T[i] in x:
    count += 1
  else:
    stock.append(count)
    count = 0

stock.sort()
print(stock[-1])

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

Solution (Python):
s = input()

ans = 0
tmp = 0

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

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

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

Solution (Python):
s = input()
import re
l = re.split('B|D|E|F|H|I|J|K|L|M|N|O|P|Q|R|S|U|V|W|X|Y|Z', s)
print(max([len(i) for i in l]))

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

Solution (Python):
from sys import stdin
from itertools import combinations

s = stdin.readline().rstrip()

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

count = 0
saikou = 0

for i in s:
    if i in li:
        count += 1
        saikou = max(saikou,count)
    else:
        count = 0
        
print(saikou)

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):
S = input()
acgt = ["A", "C", "G", "T"]
ans = 0

for i in range(len(S)):
    res = 0
    if S[i] in acgt:
        while (i < len(S)) and (S[i] in acgt):
            res += 1
            i += 1
        ans = max(ans, res)
print(ans)

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

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

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

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

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

print(ans)

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

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

def main():
    S = input().strip()
    ma = 0
    ACGT = ['A', 'C', 'G', 'T']
    count = 0
    for s in S:
        if s in ACGT:
            count += 1
        else:
            ma = max(ma, count)
            count = 0
    ma = max(ma, count)
    print(ma)


if __name__ == '__main__':
    main()

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

def main():
    S = input().strip()
    ma = 0
    ACGT = ['A', 'C', 'G', 'T']
    count = 0
    for s in S:
        if s in ACGT:
            count += 1
        else:
            ma = max(ma, count)
            count = 0
    ma = max(ma, count)
    print(ma)


if __name__ == '__main__':
    main()

Solution (Python):
S = "".join([i if i in 'ACGT' else ' ' for i in input()])
print(max([len(i) for i in S.split()]+[0]))

Solution (Python):
import re

s=input()

matched = re.findall(r'[ATGC]+',s)
ans=0

for i in matched:
    ans=max(ans,len(i))
    
print(ans)

Solution (Python):
S = list(input())
cnt=0
ans=0

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

Solution (Python):
import re
s = input()
matched = re.findall(r'[ATGC]+', s)
res = 0
for m in matched:
    res = max(res, len(m))
print(res)

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

count = 0
X =[]
for n in range(len(S)):
    if n != len(S) -1:
        if S[n] == 'A' or S[n] == 'T' or S[n] == 'C' or S[n] == 'G':
            count += 1
        else:
            X.append(count)
            count = 0
    else:
        if S[n] == 'A' or S[n] == 'T' or S[n] == 'C' or S[n] == 'G':
            count += 1
            X.append(count)
        else:
            X.append(count)
print(int(max(X)))

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

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

Solution (Python):
import sys
S = input()
N = len(S)
ans = 0
x = 0
for i in range (0,N):
  if (S[i] == "A") or (S[i] == "T") or (S[i] == "C") or (S[i] == "G"):
    x = x + 1
  else:
    ans = max(x,ans)
    x = 0
  if i == N-1:
    ans = max(x,ans)
    print(ans)
    sys.exit()

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

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

counter = 0
ans_L = []
for val in s:
    if val in L:
        counter += 1
    else:
        ans_L.append(counter)
        counter = 0
ans_L.append(counter)

print(max(ans_L))

Solution (Python):


def main():
    S = input()
    max_ACGT_length = 0
    for start in range(len(S)):
        if not (ACGT(S[start])):
            continue
        ACGT_length = 1
        for index in range(start+1,len(S)):
            if ACGT(S[index]):
                ACGT_length += 1
            else:
                break
        if ACGT_length > max_ACGT_length:
            max_ACGT_length = ACGT_length

    print(max_ACGT_length)

def ACGT(chr):
    return (chr == 'A' or chr == 'C' or chr == 'G' or chr == 'T')

if __name__ == "__main__":
    main()

Solution (Python):
S = input()

partial = ""

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

conlist = []

con = 0

for i in range(0,len(S)):
	if S[i] in conditions:
		for j in range(0,i+1):
			if S[j] in conditions:
				con +=1
			if (S[j] not in conditions) or j == i:
				conlist.append(con)
				con = 0
				

if len(conlist) > 0:
	print(max(conlist))
else:print(0)

Solution (Python):
S = input()

m = 0
cnt = 0

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

Solution (Python):
s=str(input())
ans=0
counter=0
for i in s:
	if "A" == i: counter+=1
	elif "C" == i: counter+=1
	elif "G" == i: counter+=1
	elif "T" == i: counter+=1
	else: counter=0
	ans=max(ans,counter)
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=str(input())

lens=len(s)
ans=0
list=[]

for i in range(lens):
	if (s[i]=='A')|(s[i]=='T')|(s[i]=='C')|(s[i]=='G'):
		ans=ans+1
	else:
		list.append(ans)
		ans=0
list.append(ans)
print(max(list))

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

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

print(max(ans, count))

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

Solution (Python):
s = input()

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

print(ans)

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

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

Solution (Python):
S = open(0).read()
N = len(S)
ans = 0

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

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

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

Solution (Python):
S = input()

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