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

            break
print(tmp)

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

cnt = 0
cntli = []
for i in range(len(s)):
    if s[i] in li:
        cnt += 1
    else:
        cntli.append(cnt)
        cnt = 0
else:
    cntli.append(cnt)

print(max(cntli))

Solution (Python):
S = str(input())
n = len(S)
L = ["A","C","G","T"]
w = [0]
for i in range(n):
    if S[i] in L:
        cnt = 0
        for j in range(i,n):
            if S[j] not in L:
                cnt += 1
                w.append(len(S[i:j]))
                break
        if cnt == 0:
            w.append(len(S[i::]))
print(max(w))

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

def check(s):
    for i in s:
        if not i in ['A', 'G', 'T', 'C']:
            return False
    return True

for l in range(len(S)):
    for i in range(len(S)-l+1):
        sub = S[i:i+l+1]
        
        if not check(sub):
            continue
        ans = max(len(sub), ans)
print(ans)

Solution (Python):
s=str(input())
d=dict()
d['A']='T'
d['T']='A'
d['C']='G'
d['G']='C'
cnt=0
ans=0
for i in range(len(s)):
    if s[i] in d.keys():
        cnt+=1
    else:
        ans=max(cnt,ans)
        cnt=0
ans=max(cnt,ans)

print(ans)

Solution (Python):


"""
Created on 2019/3/24
@author: shinjisu
"""




def getInt(): return int(input())
def getIntList(): return [int(x) for x in input().split()]

def getIntLines(n): return [int(input()) for i in range(n)]
def getIntMat(n, m):  
    
    mat = zeros2(n, m)
    for i in range(n):
        mat[i] = getIntList()
    return mat

def zeros(n): return [0]*n

def zeros2(n, m): return [zeros(m) for i in range(n)] 

ALPHABET = [chr(i+ord('a')) for i in range(26)]
DIGIT = [chr(i+ord('0')) for i in range(10)]
N1097 = 10**9 + 7
INF = 10**18

class Debug():
    def __init__(self):
        self.debug = True
 
    def off(self):
        self.debug = False
 
    def dmp(self, x, cmt=''):
        if self.debug:
            if cmt != '':
                print(cmt, ':  ', end='')
            print(x)
        return x


def prob():
    d = Debug()
    d.off()
    T = input()
    d.dmp((T), 'T')
    AGCT = ('A', 'T', 'C', 'G', )
    mx = 0
    for i in range(len(T)):
        for j in range(i, len(T)):
            count = 0
            for k in range(i, j+1):
                if T[k] in AGCT:
                    count += 1
                else:
                    break
            mx = max(mx, count)
            
    return mx

ans = prob()
if ans is None:
    pass
elif type(ans) == tuple and ans[0] == 1:  
    for elm in ans[1]:
        print(elm)
else:
    print(ans)

Solution (Python):
s = list(input())
l = ['A', 'T', 'C', 'G']
max_cnt = 0
cnt = 0
for i in range(len(s)):
    if s[i] in l:
        cnt += 1
    elif s[i] not in l:
        cnt = 0
    if max_cnt <= cnt:
        max_cnt = cnt
print(max_cnt)

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

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

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

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

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

Solution (Python):
t=input()
ans=0
for i in range(len(t)):
  s=[i for i in t]
  for j in range(i):
    s.pop()
  for j in range(len(s)):
    q=''.join(s)
    q=q.lstrip('ACGT')
    ans=max(ans,len(s)-len(q))
    s.pop(0)
print(ans)

Solution (Python):

s = input()

def judge(seq):
    flag = True
    group = ['A', 'T', 'G', 'C']
    for s in seq:
        if s not in group:
            flag = False
    return flag

max_len = 0
for x in range(len(s)):
    for y in range(x+1, len(s)+1):
        sub_seq = s[x:y]
        
        if judge(s[x:y]):
            max_len = max(max_len, len(s[x:y]))

print(max_len)

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

for i in range(len(s)):
    l = 0
    pos = i
    while s[pos] == 'A' or s[pos] == 'C' or s[pos] == 'G' or s[pos] == 'T':
        l += 1
        pos += 1
        if pos >= len(s):
            break

    cnt.append(l)

print(max(cnt))

Solution (Python):
S = input()
ans = []
for n in range(len(S)):
    counter = 0
    for i in range(n,len(S)):
        if (S[i] == 'A' or S[i] == 'C' or S[i] == 'G' or S[i] =='T'):
            counter+=1
        else:
            break
    ans.append(counter)
print(max(ans))

Solution (Python):
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy
from operator import itemgetter

def j(q):
    if q==1: print("Yes")
    else:print("No")
    exit(0)


def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")

def ip():
    return int(input())

def pne(n):
    print(n,end='')

rem = pow(10,9)+7




a = input()                                  







b = ["A","C","T","G"]
s = [0]
c = 0
for i in range(len(a)):
    if a[i] in b:
        c+=1
    else:
        s.append(c)
        c=0
s.append(c)
print(max(s))

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

mx_cnt = 0
cnt=0

for c in S:

    if (c == 'A') or (c == 'T') or (c == 'G') or (c == 'C') :
        cnt += 1

    else:

        if cnt > mx_cnt:
            mx_cnt = cnt

        cnt = 0

if cnt > mx_cnt:
    mx_cnt = cnt

print mx_cnt

Solution (Python):
S = input()

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

max_count = 0
count = 0
for s in S:
    if s in acgt:
        count += 1
    else:
        count = 0
    if max_count < count:
        max_count = count

print(max_count)

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

Solution (Python):
moji = input()

cnt = 0
li = [0]

last = 1000

for i in range(len(moji)):
    if moji[i] == "A" or moji[i] == "G" or moji[i] == "C" or moji[i] == "T":
        cnt += 1
        last = i
        if i == len(moji)-1:
            li.append(cnt)
    elif last == i-1:
        li.append(cnt)
        cnt = 0

print(max(li))

Solution (Python):
S=input()
B=[]
ACGT=['A','C','G','T']
for s in S:
    if s in ACGT: B.append(True)
    else: B.append(False)
B.append(False)
ans=0
for start in range(len(B)):
    if not B[start]: continue
    count=0
    for end in range(start,len(B)):
        if not B[end]:
            ans=max(ans,count)
            break
        count+=1
print(ans)

Solution (Python):
S = input()

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

print(str(count))

Solution (Python):
s = input()
pattern = "[A|C|G|T]+"

import re

result = [len(r) for r in re.findall(pattern, s)]
if len(result) == 0:
    print(0)
else:
    print(max(result))

Solution (Python):
test = input()

ans = 0

for i in range(len(test)+1):
    bubun = test[i:]
    if set(list(bubun)) <= {'A','C','G','T'}:
        ans = max(ans,len(bubun))

for i in range(len(test)+1):
    for j in range(len(test)+1):
        bubun = test[i:-j+1]
        if set(list(bubun)) <= {'A','C','G','T'}:
            ans = max(ans,len(bubun))



print(ans)

Solution (Python):
def B():
    S = input()
    helyx_str = 'ATGC'
    cnt = 0
    max_cnt = 0
    for a in S:
        h = helyx_str.find(a) 
        if h != -1:
            cnt += 1
            if max_cnt < cnt:
               max_cnt = cnt
        else:
            if max_cnt < cnt:
               max_cnt = cnt
            cnt = 0

    print(max_cnt)

if __name__ == '__main__':
    B()

Solution (Python):
import sys
import io
import math
import re

datalist = input().split()
datalist_a = list(datalist[0])

flag = 0
flag_max = 0
for data in datalist_a:
    if data == 'A' or data == 'T' or data == 'C' or data == 'G':
        flag += 1
    else:
        flag = 0
    if flag > flag_max:
        flag_max = flag
print(flag_max)

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

def f(S):
    for s in S:
        if s not in ('A', 'G', 'C', 'T'):
            return False
    return True

for i in range(len(S)+1):
    for j in range(i+1, len(S)+1):
        sbstr = S[i:j]
        if f(sbstr):
            if(max_len <= j-i):
                max_len = j-i
print(max_len)

Solution (Python):
s = input()

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

Solution (Python):
A = list(input())
c = 0 
d = 0 
m = 0 
i = 0
while i<len(A):
    if c == 0:
            if A[i] =="A" or A[i] == "C" or A[i] == "G" or A[i] == "T":
                c = 1
                d = 1
                
    elif c == 1 and A[i] =="A" or A[i] == "C" or A[i] == "G" or A[i] == "T":
        d +=1
    elif c == 1:
        m = max(m,d)
        d = 0
    i += 1
m = max(m,d)
print(m)

Solution (Python):
s=input()
ls=["A",'C','G','T']
ans=0
u=0
i=0
while i < len(s):
  if s[i] in ls:
    cnt=1
    i+=1
    while i<len(s) and s[i] in ls:
      i+=1
      cnt+=1
    ans=max(cnt,ans)
  i+=1
print(ans)

Solution (Python):


total = 0
temp = 0
S = input()

for i in range(len(S)):
    if S[i] == 'A' or S[i] == 'G' or S[i] == 'C' or S[i] == 'T':
        temp += 1
    else:
        if temp > total:
            total = temp
        temp = 0

if temp > total:
    total = temp

print(total)

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

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

Solution (Python):
list_original=input()
box=list(list_original)
MAX = 0
count = 0
flag = 0
for figure in box:
  if figure == 'A' or figure =='T' or figure =='C' or figure == 'G':
    flag = 1
  else:
    flag = 0
    count = 0
  if flag == 1:
    count += 1
  if count > MAX:
    MAX = count
print(MAX)

Solution (Python):
str=input()
char_list = list(str)
N=len(char_list)

tmp=0
max=0
for i in range(N):
    if char_list[i] in ['A' , 'T' , 'G' , 'C']:
        tmp+=1
        if tmp>max:
            max=tmp
    else: tmp=0

print(max)

Solution (Python):
def solve(b):
    u = []
    lenu = []
    p = ''
    for i in range(len(b)):
        if (b[i]=='A')or(b[i]=='T')or(b[i]=='G')or(b[i]=='C'):
            p += b[i]
        else:
            u.append(p)
            lenu.append(len(p))
            p=p.replace(p,'')
    u.append(p)
    lenu.append(len(p))
    
    
    
    

    print(max(lenu))


 
 
def main():
    b = input()
    solve(b)
 
 
if __name__ == '__main__':
    main()

Solution (Python):


from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

S = raw_input()
cnt = ans = 0
for c in S:
    if not c in 'ATCG':
        ans = max(cnt, ans)
        cnt = 0
    else:
        cnt += 1
print max(ans, cnt)

Solution (Python):
n=input()
l=["A","T","C","G"]
res=0
cnt=0

for i in range(len(n)):
  if n[i] in l:
    cnt+=1
    if cnt>res:
      res=cnt
  else:
    cnt=0
    if cnt>res:
      res=cnt
      
print(res)

Solution (Python):
s = input()
m = 0
c = 0
S = {"A", "C", "G", "T"}
for i in range(len(s)):
    if s[i] in S:
        c += 1
    else:
        if c != 0:
            if c > m:
                m = c
            c = 0

if c > m:
    m = c

print(m)

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

Solution (Python):
s = input()

acgt = 'ACGT'

max_len = 0
for i in range(len(s)):
    j = 0
    while True:
        if i + j >= len(s) or s[i + j] not in acgt:
            if max_len < j:
                max_len = j
            break
        j += 1

print(max_len)

Solution (Python):
import re
cstr = input()
result = re.findall("[ACGT]+", cstr)
nums = [len(s) for s in result]
if not nums:
    nums = [0]
print(max(nums))

Solution (Python):

s = input()

max_acgt = ''
candidate = ''
for bs in s:
    if 'A' == bs or 'T' == bs or 'G' == bs or 'C' == bs:
        candidate += bs
    else:
        if len(max_acgt) < len(candidate):
            max_acgt = candidate
            candidate = ''
else:
    if len(max_acgt) < len(candidate):
            max_acgt = candidate
    print(len(max_acgt))

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

Solution (Python):
S = list(input())
l = [0] * 5
ind = 0
f = True

for i in range(len(S)):
    if (S[i] == 'A' or S[i] == 'C' or S[i] == 'G' or S[i] == 'T') and f:
        l[ind] += 1
    elif (S[i] == 'A' or S[i] == 'C' or S[i] == 'G' or S[i] == 'T') and f == False:
        l[ind] += 1
    else:
        f = False
        ind += 1
print(max(l))

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

Solution (Python):
S = input()
t = []
u = []
for i in range(len(S)):
    if S[i] in 'AGTC':
        u.append(S[i])
    else:
        w = u.copy()
        t.append(w)
        u = []
t.append(u)
v = [len(i) for i in t]
print(max(v))

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

ans = max(count,ans)
count = 0

print(ans)

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

Solution (Python):
S=input()
n=0
for i in range(len(S)):
    for j in range(i, len(S)+1):
        s=S[i:j]
        if len([c for c in s if c in "ACGT"]) == len(s):
            n=max(n, len(s))
print(n)

Solution (Python):
s = input()

max_len = 0
len = 0
for e in s:
    if e == 'A' or e == 'C' or e == 'G' or e == 'T':
        len += 1
    else:
        if max_len < len:
            max_len = len
        len = 0

if max_len < len:
    max_len = len
print(max_len)

Solution (Python):
import re
S = input()
ans = ['']
for i in range(len(S)):
    for k in range(i, len(S)):
        ans.append(S[i:k+1])
ans = sorted(ans,key=lambda x:len(x),reverse=True)
for i in ans:
    if len(re.sub("[ACGTacgt]", "", i)) == 0:
        print(len(i))
        break

Solution (Python):
def main():
    S = input()
    S_list = [str(c) for c in S]

    max_count = 0
    for i, c in enumerate(S_list):
        counter = 0
        for j in range(i, len(S_list)):
            if S_list[j] == "A" or S_list[j] == "C" or S_list[j] == "G" or S_list[j] == "T":
                counter += 1
            else:
                break
        if max_count < counter:
            max_count = counter

    print(max_count)


if __name__ == '__main__':
    main()

Solution (Python):
S = input()
cdt = []
before_invalid = False


def is_acgt(char):
    if char == 'A':
        return True
    if char == 'C':
        return True
    if char == 'G':
        return True
    if char == 'T':
        return True
    return False


for i in S:
    if is_acgt(i):
        if not before_invalid:
            cdt.append(1)
        else:
            current = len(cdt) - 1
            cdt[current] = cdt[current] + 1
        before_invalid = True
    else:
        before_invalid = False

ans = 0
if len(cdt) > 0:
    ans = max(cdt)
print(ans)

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

Solution (Python):
S = input()
ans = 0
for i in range(len(S)):
    for q in range(i,len(S)+1):
        if {"A","C","G","T"} >= set(S[i:q]):
            ans = max(ans,len(S[i:q]))
print(ans)

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

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

list = [0]
for i in range(len(S)):
    count = 0
    if S[i] == "A" or S[i] == "T" or S[i] == "C" or S[i] == "G":
        count = 1 + list[i]
    list.append(count)

print(max(list))

Solution (Python):
wlist = list(input())
wlength = 0
tmp = 0
for w in wlist:
    if not w in ["A","T","G","C"]:
        tmp = 0
        continue

    else:
        tmp += 1
        if tmp >= wlength:
            wlength = tmp
print(wlength)

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

for i in range(len(S)):
    if S[i] in acgt:
        j = i
        while True:
            if j < len(S) - 1 and S[j + 1] in acgt:
                j += 1
            else:
                break
        ans = max(j - i + 1, ans)

print(ans)

Solution (Python):
import numpy as np

s=input()
isContinue=0
part=[0]

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

print(max(part))

Solution (Python):
s=str(input())
s=list(s)
l=[]

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

count=0
a=[]
for i in range(len(s)):
    if (l[i]!=0):
        
        count+=1
    a.append(count)
    if l[i]==0:
        count=0

print(max(a))
"""     
        print()
    while l[i]==1:
        count+=1
        print(count)
 """

Solution (Python):
import re
S = input()

s = re.sub(r"[ACGT]", "
s = re.sub(r"[^

l = s.split("X")

l_len = [len(l_i) for l_i in l]
print(max(l_len))

Solution (Python):
from sys import stdin

def main():
    S = input()

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

input = lambda: stdin.readline().rstrip()
main()

Solution (Python):

AGCT = "AGCT"

S = input()

longest = ""
tmpCounter = 0
for i in range(len(S)):
	
	if S[i] in AGCT:
		if tmpCounter >= len(longest):
			longest = S[i - tmpCounter: i  + 1]
		tmpCounter += 1
	else:
		if tmpCounter > len(longest):
			longest = S[i - tmpCounter: i]
		tmpCounter = 0


print(len(longest))

Solution (Python):
s = input()
s = s.translate(str.maketrans({"T":"A", "G":"A", "C":"A"}))
for i in [10,9,8,7,6,5,4,3,2,1,0]:
  if "A"*i in s:
    print(i)
    break

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

Solution (Python):
from sys import stdin
S=(stdin.readline().rstrip())
ans=0
for i in range(0,len(list(S))+1):
    for j in range(0,len(list(S))+1):
        if set(list(S)[i:j]) <= {"A","T","C","G"}:
            if len(list(S)[i:j]) > ans:
                ans=len(list(S)[i:j])
print(ans)

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

Solution (Python):
s = input()

ma = 0
for i in range(len(s)):
    for j in range(1,len(s)-i+1):
        tmp = s[i:i+j]
        
        is_good = True
        for c in tmp:
            if c not in "AGCT":
                is_good = False
                break
        if is_good:
            if (len(tmp)) > ma :
                ma = len(tmp)

print(ma)

Solution (Python):
s = input()
l = []
for i in range(len(s)):
    if s[i] == 'A' or s[i] == 'T' or s[i] == 'G' or s[i] == 'C':
        l.append(1)
    else:
        l.append(0)
tmp = 0
counter = []
for i in range(len(l)):
    if l[i] == 0:
        counter.append(tmp)
        tmp = 0
    else:
        if i == len(l) - 1:
            tmp += 1
            counter.append(tmp)
        else:
            tmp += 1

print(max(counter))

Solution (Python):
s = str(input())
S = []
for c in s:
    S.append(c)
    
count = 0
maxcount = 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:
        count = 0
    if (maxcount < count):
        maxcount = count



print(maxcount)

Solution (Python):
s= input()

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

if c>max:
  print(c)
else:
  print(max)

Solution (Python):
import re
import numpy as np
s = input()
atgcs = re.split(r'[^ATGC]', s)
lens = np.array(list(map(len, atgcs))).max()
print(lens)

Solution (Python):






S=input()
t=list()
ct=0
for i in range(len(S)):
    if S[i]=='A' or S[i]=='C' or S[i]=='T' or S[i]=='G':
        i+=1
        ct+=1
    else:
        t.append(ct)
        ct=0
        i+=1
t.append(ct)
print(max(t))

Solution (Python):
S = input()

max_length = 0

for i in range(0, len(S)):
    for j in range(i + 1, len(S) + 1):
        sub = S[i:j]
        
        if len(sub.translate(str.maketrans({'A':'','C':'','G':'','T':''}))) == 0:
            max_length = max(len(sub), max_length)


print(max_length)

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

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

Solution (Python):
S=raw_input()
C="ACGT"

len_S=len(S)

ans=float("-inf")
for i in range(len_S+1):
	for j in range(i,len_S+1):
		s=S[i:j]
		for x in s:
			if x not in C:
				break
		else:
			ans=max(ans,len(s))

print ans

Solution (Python):
S = list(input())
ansarr = []
ans = 0
ansarr.append(ans)
for i in S:
    if ans == 0:
        if i == 'A' or i == 'C' or i == 'G' or i == 'T':
            ans += 1
    else:
        if i == 'A' or i == 'C' or i == 'G' or i == 'T':
            ans += 1
        elif i != 'A' or i != 'C' or i != 'G' or i != 'T':
            ansarr.append(ans)
            ans = 0
else:
    ansarr.append(ans)


print(max(ansarr))

Solution (Python):
import re
S = input()

splited = re.split('[^ATGC]+', S)

max_len = 0
for item in splited:
  if len(item) >= max_len:
    max_len = len(item)

print(max_len)

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

Solution (Python):
import re
i = input()
print(max(len(s) for s in re.findall(r'[ATGC]*', i)))

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

acgt=False
length=0
maxlen=0
for i in S:
  if acgt:
    if i=="A" or i=="G" or i=="C" or i=="T":
      length += 1
    else:
      maxlen = max(maxlen, length)
      acgt = False
  else:
    if i=="A" or i=="G" or i=="C" or i=="T":
      length = 1
      acgt = True
    else:
      continue
if acgt:
  maxlen = max(maxlen, length)

print(maxlen)

Solution (Python):
s=list(str(input()))
l=[]
for i in range(len(s)):
    if s[i]=="A" or s[i]=="T" or s[i]=="G" or s[i]=="C":
        l.append(1)
    else:
        l.append(0)
tl=[]
for k in range(len(l)):
    ctr=0
    for i in range(k,len(l)):
        if l[i]==1:
            ctr+=1
        else:
            break
    tl.append(ctr)
print(max(tl))

Solution (Python):
import numpy as np

def main():
	S=input()
	array=[]
	pack=['A','T','G','C']
	for i in range(len(S)):
		temp=False
		for j in range(len(pack)):
			if(S[i]==pack[j]):
				temp=True
		if(temp):
			array.append(1)
		else:
			array.append(0)
	
	result=[]
	for i in range(len(array)):
		temp=0
		for j in range(i,len(array)):
			if(array[j]==1):
				temp+=1
			else:
				break
		result.append(temp)
	
	print(max(result))


def inputList():
	a=list(map(int,input().split()))
	return a

def multisort(li,index):
	return sorted(li,key=lambda x: x[index])

if(__name__=='__main__'):
	main()

Solution (Python):


s  = input()

a = 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':
        a = a+1
    else:
        a = 0

    if max < a:
        max = a

print(max)

Solution (Python):
s = input() 

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

now = 0
ans = 0
for c in s:
    if c in acgt:
        now += 1
    else:
        ans = max(ans, now)
        now = 0

ans = max(ans, now)
print(ans)

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

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

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

Solution (Python):


import re

if __name__ == '__main__':

    s = input()

    s = re.sub(r'[^ACGT]+', '_', s)


    maxlen = 0

    for ss in s.split('_'):
        if len(ss) > maxlen:
            maxlen = len(ss)

    print(maxlen)

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

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

Solution (Python):
a = input()
l = len(a)
ans = 0
for i in range(l):
	tmp = 0
	for j in range(l-i):
		if a[i+j] != "A" and a[i+j] != "G" and a[i+j] != "C" and a[i+j] != "T":
			break
		tmp += 1
	if ans < tmp:
		ans = tmp
print(ans)

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

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

print(res)

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

Solution (Python):
from sys import stdin
s = list(stdin.readline().rstrip())
counts=[]
count=0
for i in s:
    if i in ['A','G','C','T']:
        count+=1
        counts.append(count)
    else:
        count=0
        counts.append(count)
print(max(counts))

Solution (Python):
from sys import stdin

S = stdin.readline().rstrip()
countlist = []

count = 0
for s in S:
    if s == "A" or s == "C" or s == "G" or s == "T":
        count += 1
    else:
        countlist.append(count)
        count = 0
countlist.append(count)
print(max(countlist))

Solution (Python):
s_list = list(input())
str_list = ['A','C','G','T']
now_max = 0
for i,s in enumerate(s_list):
    if s in str_list:
        l = 1
        for next in s_list[i+1:]:
            if next in str_list:
                l += 1
            else:
                break
        now_max = max(l,now_max)
print(now_max)

Solution (Python):
A = input()
a = [str(c) for c in A]
ans = 0
c = 0
for i in a:
	if i == "A" or i =="C" or i == "G" or i =="T":
		c = c + 1
	else:
		if c > ans:
			ans = c
		c = 0
if c > ans:
	ans = c
print(ans)

Solution (Python):
char = input()

max_num = 0
max_seq = ''

def include(char):
    for c in char:
        if c not in ['A', 'T', 'G', 'C']:
            return False
    return True

for i in range(len(char)):
    for j in range(i, len(char)):
        sub = char[i:j+1]
        if include(sub):
            if max_num < len(sub):
                max_num = len(sub)
                max_seq = sub

print(max_num)

Solution (Python):
s = input()
res = 0
for i in range(len(s)):
  words = s[i:]
  m = 0
  for word in words:
    if word in 'ACGT':
      m += 1
    else:
      break
  res = max(res, m)
print(res)