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):
ansMax = 0
S = input()
sLen = len(S)
for i in range(sLen):
    for j in range(i, sLen):
        if all('ACGT'.count(k) == 1 for k in S[i: j + 1]):
            ansMax = max([ansMax, j - i + 1])

print(ansMax)

Solution (Python):
s=input()
at='ACGT'
cnt=0
ans=[0]
for i in s:
    if i in at:
        cnt+=1
        ans+=[cnt]
    else:

        cnt=0
ans.sort()
print(ans[-1])

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

count = 0
max = 0

for moji in S:
    if moji == "A"or moji == "T"or moji == "G"or moji == "C":
        count += 1
        if count > max:
            max = count
    else:
        count = 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):
ml = 0
s = str(input())
acgt = ["A","C", "G", "T"]

def count_acgt(s, i):
    v = 0
    for t in range(i, len(s)):
        if s[t] in acgt:
            v += 1
        else:
            break
    return v

for i, _ in enumerate(s):
    n = count_acgt(s, i)
    if n >= ml:
        ml = n

print(ml)

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

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

print(ans)

Solution (Python):
s = input()
alp = [chr(ord('A') + i) for i in range(26)]
alp.remove('A')
alp.remove('C')
alp.remove('G')
alp.remove('T')

ans = 0
for i in range(len(s)):
    for j in range(i + 1, len(s) + 1):
        flg = True
        for k in alp:
            if k in s[i:j]:
                flg = False
                break
        if flg:
            ans = max(ans, j - i)
print(ans)

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

Solution (Python):
S = input()
le = len(S)
ACGT = ['A','C','G','T']
cntlist = []
for i in range(le):
    cnt = 0
    for d in ACGT:
        if S[i] == d:
            cnt += 1
            for j in range(i+1,le):
                t = 0
                for d_ in ACGT:
                    if S[j] == d_:
                        cnt += 1
                        t += 1
                if t == 0: break
                    
    cntlist.append(cnt)


print(max(cntlist))

Solution (Python):
data=input()
count=0
start=0
maxLen=0
for i in range(len(data)):
  if data[i] in "AGCT":
    if i>0:
      if data[i-1] not in "AGCT":
        start=i
    else:
      start=i
    if i<len(data)-1:
      if data[i+1] not in "AGCT":
        length=i-start+1
        if length>maxLen:
          maxLen=length
    else:
      length=i-start+1
      if length>maxLen:
        maxLen=length
print(maxLen)

Solution (Python):
s = input()

atgc = 'ATGC'
count= 0
max_count = 0

for i in range(len(s)):
    if s[i] in atgc:
        count += 1
    else:
        count = 0
    if max_count < count:
            max_count = count
print(max_count)

Solution (Python):
S = input()

ans = 0
for s in range(len(S)):
    for e in range(1,len(S) - s + 1):
        c = 0
        str = S[s:s+e]
        c += str.count('A')
        c += str.count('C')
        c += str.count('G')
        c += str.count('T')
        if c == len(str):
            ans = max(ans,len(str))
            

print(ans)

Solution (Python):


def io_generator():
	return input()



def main(io):
	str=list(io())
	
	agct=list('AGCT')
	max=0
	current=0
	
	for c in str:
		if c in agct:
			current+=1
			max = current if current > max else max
		else:
			current=0	
	
	return max



if __name__ == "__main__":
	io= lambda : io_generator()
	print (main(io))

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

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

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

Solution (Python):
s=input()
s=s.translate(str.maketrans({'C': 'A', 'G': 'A' , "T": "A"}))

l = list(s)

a=len(l)

ans=[0]*a
j=0
for i in range(a):
  if l[i]=="A":
    ans[j]+=1
  else:
    j+=1
 
print(max(ans))

Solution (Python):

import sys


def solve(S: str):
    max_len = 0
    def isvalid(s):
        return s in ['A', 'C', 'G', 'T']

    for i in range(len(S)):
        if not isvalid(S[i]):
            continue
        j = i + 1
        while j < len(S) and isvalid(S[j]):
            j += 1
        max_len = j-i if j-i > max_len else max_len
    print(max_len)
    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):
a = list(input())
b = 0
c = 0

for i in range(len(a)):
  if a[i] == "A":
    b = b + 1
  elif a[i] == "C":
    b = b + 1
  elif a[i] == "G":
    b = b + 1
  elif a[i] == "T":
    b = b + 1
  else :
    if c < b :
      c = b
      b = 0
    else :
      b = 0
if c < b :
      c = b
      b = 0
else :
      b = 0
     
print(c)

Solution (Python):
S = input()

ans = 0

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


print(ans)

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

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

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):
S = input()
mx = 0
for i in range(len(S)):
    for j in range(i, len(S) + 1):
        s = S[i:j]
        flag = True
        for si in s:
            if si not in ["A", "C", "G", "T"]:
                flag = False
        if flag:
            mx = max(mx, len(s))

print(mx)

Solution (Python):
s = input()

ans=0
base = set(['A','C','G','T'])
i = 1
while i <= len(s):
    j = 0
    while j+i <= len(s):
        word = set(s[j:j+i])
        if word <= base:
            ans = len(s[j:j+i])
        j += 1
    i += 1
print (ans)

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

Solution (Python):
from itertools import groupby
s = input()
a = [1 if c in ['A', 'G', 'C', 'T'] else 0 for c in s]
l = 0
for n, c in groupby(a):
	c = sum(1 for i in c)
	if n == 1 and c > l:
		l = c
print(l)

Solution (Python):

S = input()
ans = 0
count = 0

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

print(ans)

Solution (Python):
S = list(input())
A = "ATCG"
count = 0
res = [0]
for s in S:
	if s in A:
		count += 1
		res.append(count)
	else:
		count = 0
print(max(res))

Solution (Python):
def main():
    S = input()
    cnt = 0
    ans = 0
    for c in S:
        if c in "ACGT":
            cnt += 1
        else:
            cnt = 0
        ans = max(ans, cnt)
    print(ans)


if __name__ == "__main__":
    main()

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

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

Solution (Python):
S = input()

len_ = 0
ans = 0

for ch in S:
    if ch in "AGCT":
        len_ += 1
        ans = max(ans, len_)
    else:
        len_ = 0
print(ans)

Solution (Python):
S = str(input())
l = ['A','C','G','T']
c = 0
cplus = 0

for i in S:
    if i in l:
        cplus += 1
        c = max(c, cplus)
    else:
        cplus = 0
print(c)

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

Solution (Python):
import re

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

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 = list(input())
ans = 0
count = 0
for i in s:
    if i in "AGCT":
        count += 1
        ans = max(ans, count)
    else:
        count = 0

print(ans)

Solution (Python):
S = input()
maxLength = 0
start, flag = -1, False
for i in range(len(S)):
    if S[i] in {"A", "G", "C", "T"}:
        if not flag:
            flag = True
            start = i
    else:
        if flag:
            maxLength = max(maxLength, i - start)
            flag = False
if flag: maxLength = max(maxLength, len(S) - start)
print(maxLength)

Solution (Python):
s = "ACGT"

a = input()
n = len(a)

ans = 0
for i in range(n):
    if a[i] not in s:
        continue

    j = i
    while j<n and a[j] in s:
        j += 1
    ans = max(ans, j-i)

print(ans)

Solution (Python):
S=input()
count=0
result=0
for i in S:
    if i in 'AGTC':
        count+=1
        result=max(result,count)
    else:
        count=0
print(result)

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

Solution (Python):



get = lambda: int(raw_input().strip())
gets = lambda: [int(i) for i in raw_input().strip().split()]
getss = lambda n: [gets() for _ in xrange(n)]


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


def solve(S):
    res = cur = 0
    for c in S:
        if c in m:
            cur += 1
            res = max(res, cur)
        else:
            cur = 0
    print res

S = raw_input().strip()
solve(S)

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

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

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

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

Solution (Python):
S = list(input())
ans = 0
c = 0
for i in S:
    if i == "A" or i == "T" or i == "G" or i == "C":
        c += 1
    else:
        c = 0
    if c > ans:
        ans = c

print(ans)

Solution (Python):



def start_process(a):
    dict = ['A', 'G', 'T', 'C']

    ans = 0
    count = 0
    for char in list(a):
        if char in dict:
            count += 1
        else:
            if ans < count:
                ans = count
            count = 0
    if ans < count:
        ans = count
    print(ans)


def main():
    a = input()
    start_process(a)

if __name__ == '__main__':
    main()

Solution (Python):

s = input()
temp = 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'):
        temp += 1
        if(temp>ans):
            ans = temp
    else:
        temp = 0
print(ans)

Solution (Python):
S=input()
A=[0 for x in range(len(S))]

if S[0]=="A" or S[0]=="T" or S[0]=="C" or S[0]=="G":
  A[0]=1

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

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

for i in range(n):
    for j in range(i,n):
        if all('ATGC'.count(k) == 1 for k in s[i:j+1]):
            ans = max(ans,j-i+1)

print(ans)

Solution (Python):
string = input()
ch = string[0]
max_string_len = 0
prev_len = 0
for idx,ch in enumerate(string):
  if ch  in {"A","T","G","C"}:
    prev_len += 1
    max_string_len = max(max_string_len,prev_len)
  else:
    prev_len = 0
    
print(max_string_len)

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

alp = 'ATCG'
cnt = []

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

print(max(cnt))

Solution (Python):
S = list(input())
ma = 0
n = len(S)

for i in range(n):
    for j in range(n):
        if i <= j:
            reS = S[i:j+1]
            l = len(reS)
            re = reS.count("A") + reS.count("C") + reS.count("G") + reS.count("T")
            if l == re:
                ma = max(ma, re)

print(ma)

Solution (Python):
S = input()
N = len(S)
tmp = ['']
x = {'A', 'C', 'G', 'T'}
for i in range(N):
    for j in range(i, N):
        if set(S[i:j+1]) <= x:
            tmp.append(S[i:j+1])
print(max(map(len, tmp)))

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

Solution (Python):
inp = input()
res = 0
for i in range(len(inp)+1):
  for j in range(i+1, len(inp)+1):
    if len([w for w in inp[i:j] if w in ["A", "C", "G", "T"]]) == (j-i):
      res = max(res, j-i)
print(res)

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

S=str(input())
L=len(S)
count=0
ans=0
for i in range(L):

    if S[i] in dna:
        count += 1
    else:
        ans = max(ans,count)
        count=0

print(max(ans,count))

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

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

Solution (Python):
S = input()
N = len(S)
x = 0
for a in range(N):
  for b in range(a+1,N+1):
    if all(x in 'ATGC' for x in S[a:b]):
      x = max(x, b-a)
      
      
print(x)

Solution (Python):
S=input()
flag=0
count=0
begin=0
max_begin=0
max_count=0
for i in range(len(S)):
    if flag==0:
        
        if S[i]=="A" or S[i]=="T" or S[i]=="C" or S[i]=="G":
            begin=i
            count+=1
            flag=1
            
    else:
        if S[i]=="A" or S[i]=="T" or S[i]=="C" or S[i]=="G":
            count+=1
            
        else:
            if max_count<count:
                max_count=count
                max_begin=begin
            flag=0
            count=0
if max_count<count:
    max_count=count
print(max_count)

Solution (Python):
S = input()
S = S+"0"
max = 0
j = -1
for i in range(0, len(S)):
    if not(S[i]=="A" or S[i]=="C" or S[i]=="G" or S[i]=="T"):
        if max<i-j-1:
            max = i-j-1
        j = i
print("{}".format(max))

Solution (Python):

s = input()
N = len(s)
ans = 0
for i in range(N):
    for j in range(i+1, N+1):
        ok = True
        for k in range(i, j):
            if s[k] not in 'ACGT':
                ok = False
        if ok:
            ans = max(ans, j - i)
print(ans)

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

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

Solution (Python):
ATGC = ["A", "T", "G", "C"]
s = input()
max_length = 0
tmp_length = 0
for car in s:
    if car in ATGC:
        tmp_length += 1
    else:
        max_length = max(max_length, tmp_length)
        tmp_length = 0

max_length = max(max_length, tmp_length)
print(max_length)

Solution (Python):
S = input()
n = len(S)
char = ['A','C','G','T']

mx = 0
for i in range(n):
	for j in range(i,n):
		part = S[i:j+1]
		if all(c in char for c in part) and mx<len(part):
			mx = len(part)

print(mx)

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

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

a = -1
b = -1

L = 0
R = -1
mode = 1
for i in range(len(s)):
    if mode == 0:
        if s[i] in base:
            b += 1
        else:
            mode = 1
            if b - a > R - L:
                L = a
                R = b
    elif mode == 1:
        if s[i] in base:
            a = i
            b = i
            mode = 0

if mode == 0 and b - a > R - L:
    L = a
    R = b

print(R - L + 1)

Solution (Python):


s=raw_input()
res=0
for i in xrange(len(s)):
 for j in xrange(i,len(s)):
  if all('ACGT'.count(c)==1 for c in s[i:j+1]):
   res=max(res,j-i+1)
print res

Solution (Python):
input = input()

max = 0
count = 0
result = []

for s in input:
	
	if s in ('A','T','C','G'):
		
		result.append(s)
		
		if max < len(result):
			max = len(result)
		
	else:
		result = []
		
print(max)

Solution (Python):
a = " "+input()
dp = [0]*11
for i ,n in enumerate(a[1:]):
    if n in ["A","T","C","G"]:
        dp[i]=dp[i-1]+1
    else:
        dp[i] = 0
print(max(dp))

Solution (Python):
S = input()
maxv = 0
tmp = 0
t = list("ATCG")
for i in range(len(S)):
    if S[i] in t:
        tmp += 1
        maxv = max(maxv, tmp)
    else:
        tmp = 0
print(maxv)

Solution (Python):
n = input()
m = 0
max_m = 0 
for s in n:
    if s in "ATCG":
        m += 1
    else:
        m = 0
    if m > max_m:
        max_m = m
print(max_m)

Solution (Python):
S = input()
l=0
max_l =0
for i in S:
  if i in 'ATCG':
    l+=1
  else:
    l=0
  if l> max_l:
    max_l = l
print(max_l)

Solution (Python):
S = input()

ret = 0
current = 0
for i in range(len(S)):
  if S[i] in ['A', 'T', 'G', 'C']:
    current += 1
    ret = max(ret, current)
  else:
    current = 0
print(ret)

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

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

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

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

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

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

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

Solution (Python):
length, max_length = 0, 0
s = input()

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

print(max_length)

Solution (Python):
s = raw_input()
best = 0
l = ['A','G','C','T']
cur = 0
for x in s:
  if x in l:
    cur += 1
    if cur > best:
      best = cur
  else:
    cur = 0
print best

Solution (Python):
def solve():
  S = input().strip()
  cur, mak = 0,0
  for x in S:
    cur = cur+1 if x in "ACGT" else 0
    mak = max(mak, cur)
  print(mak)


if __name__ == '__main__':
  solve()

Solution (Python):
s = input()
li = list(s)
max = 0
count = 0

for i in li:
    if i == 'A' or i == 'C' or i == 'G' or i == 'T':
        count += 1
    else:
        if max < count:
            max = count
        count = 0
if max < count:
    max = count

print(max)

Solution (Python):
s = input().strip()
enki = set('ATCG')
count = 0
maxlen = 0
for c in s:
    if c in enki:
        count += 1
    else:
        maxlen = max(maxlen, count)
        count = 0
maxlen = max(maxlen, count)
print(maxlen)

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()
a = 'ATGC'
cnt = 0
ans = 0
for i in s:
    if i in a:
        cnt += 1
        ans = max(ans,cnt)
    else:
        cnt = 0
print(ans)

Solution (Python):
import re
print(max(x.end()-x.start() for x in re.finditer('[ACGT]*',input())))

Solution (Python):
S = input()
i = None
ans = 0
for j in range(len(S)):
    if S[j] not in ("A", "C", "G", "T"):
        i = None
        continue
    if i is None:
        i = j
    ans = max(ans, j - i + 1)
print(ans)

Solution (Python):
S = input()

lenmax = 0
lenACGT = 0
for s in S:
    if(s in "ACGT"):
        lenACGT += 1
    else:
        lenACGT = 0
    if(lenmax < lenACGT):
        lenmax = lenACGT


print(str(lenmax))

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()

def main():
    S = SI()
    arr = []
    tmp = 0
    for s in S:
        if s in 'ACGT':
            tmp += 1
        else:
            tmp = 0
        arr.append(tmp)
    ans = max(arr)

    return ans

print(main())

Solution (Python):
p=m=0
for c in input():p=-~p*(c in'ATGC');m=max(m,p)
print(m)

Solution (Python):


S = input()

def getAns(S) :
    cnt = 0
    rtn = 0
    for i in S :
        if i == "A" or i == "C" or i == "G" or i == "T" :
            cnt += 1
            rtn = max(cnt, rtn)
        else :
            cnt = 0
    return rtn

print(getAns(S))

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

Solution (Python):
import re
ptn = re.compile(r"(A|C|G|T)*")

S = input()

ans = 0
for i in range(len(S)):
  for j in range(len(S)):
    x = ptn.match(S[i:i+j+1]).group(0)
    if(x):
      ans = max(ans, len(x))
print(ans)

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

Solution (Python):
p=0
m=0
for c in input():
  p+=1
  if not c in"ATGC":p=0
  m=max(m,p)
print(m)

Solution (Python):
S = input()
replaced = ""
for s in S:
  if s in "ACGT":
    replaced += "1"
  else:
    replaced += "0"
    
print(max([len(r) for r in replaced.split("0")]))

Solution (Python):
S = input()

l_max, l = -1, 0

for c in S:
    if c in ['A', 'C', 'G', 'T']:
        l += 1
    else:
        l_max = l if l > l_max else l_max
        l = 0

print(max(l, l_max))

Solution (Python):
s = input()
N = len(s)
ans = 0
for left in range(N):
    for right in range(left + 1, N + 1):
        
        if all(c in 'ACGT' for c in s[left:right]):
            ans = max(ans, right - left)
print(ans)

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

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

Solution (Python):
if __name__ == '__main__':
  V = input()
  
  
  
  flg = 0
  max_v = 0
  for i in V:
    
    if i == 'A' or i=='T' or i=='G' or i=='C':
      flg += 1
      max_v = max(max_v, flg)
    else:
      flg = 0
      
  print(max_v)

Solution (Python):
s=list(input())
n=len(s)
T="ACGT"
cnt=[0]*20
total=[0]*20
for i in range(n):
    if s[i] in T:
        cnt[i]=1
for i in range(1,n+1):
    if cnt[i-1]==1:
        total[i]=total[i-1]+1
    else:
        total[i]=0
print(max(total))

Solution (Python):
import re;print(max(map(len,re.findall('[ATGC]*',input()))))

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

Solution (Python):
s = input()
ATGC= ("A", "T", "G", "C")
ans, test = 0, 0

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

Solution (Python):
import re
print(max(len(s) for s in re.split(r'[^ATGC]+', input())))

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

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

Solution (Python):
S = input()

cnt = 0
a = []
for i in range(len(S)):
    if S[i] == 'A' or S[i] == 'T' or S[i] == 'G' or S[i] == 'C':
        cnt += 1
        if i == len(S) - 1:
            a.append(cnt)
    else:
        lenflag = False
        a.append(cnt)
        cnt = 0
print(max(a))

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

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

Solution (Python):
S = input()
current = 0
ret = 0
for x in S:
    if x in 'ACGT':
        current += 1
        ret = max(ret, current)        
    else:
        current = 0
print(ret)

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

Solution (Python):
import sys

input = sys.stdin.readline
s = input()
acgt = ['A', 'C', 'G', 'T']
cnt, tmp = 0, 0
for c in s:
    if c in acgt:
        tmp += 1
    else:
        cnt = max(cnt, tmp)
        tmp = 0
print(cnt)

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

Solution (Python):

S = input()
ans = 0
for l in range(len(S)):
    for r in range(1, len(S) + 1):
        if l < r and all(S[k] in list('ACGT') for k in range(l, r)):
            ans = max(ans, r - l)
print(ans)

Solution (Python):
S = input()
ret = 0
for x in range(len(S)):
    for y in range(x + 1, len(S) + 1):
        s = S[x:y]
        if all([x in 'ACGT' for x in s]):
            ret = max(ret, len(s))
print(ret)

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()
n = len(S)
ans = 0
for i in range(n):
    for j in range(i, n):
        
        if not any('ACGT'.count(c) == 0 for c in S[i:j + 1]):
            ans = max(ans, j - i + 1)
print(ans)

Solution (Python):
from sys import stdin

s = list(stdin.readline().rstrip())
acgt = ['A', 'C', 'G', 'T']

ans = 0
tmp = 0

for i in s:
    if i in acgt:
        tmp += 1
    else:
        if ans <= tmp:
            ans = tmp
        tmp = 0

if ans <= tmp:
    ans = tmp

print(ans)

Solution (Python):
x = input()
count = 0
ans = 0
for i in x:
    if(i == 'A' or i == 'T' or i == 'C' or i == 'G'):
        count += 1
        if(count > ans):
            ans = count
    else:
        count = 0
print(ans)

Solution (Python):
p = 'ACGT'
s = input()
l = len(s)
r = 0
i = -1
while i < l:
 j = next((i for i in range(i + 1, l) if s[i] in p), l)
 i = next((i for i in range(j + 1, l) if s[i] not in p), l)
 r = max(r, i - j)
print(r)

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

Solution (Python):
import re;print(max(map(len,re.findall('[ATGC]*',input()))))

Solution (Python):
def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

s = input()
lis = ["A", "T", "G", "C"]
cnt = 0
maxcnt = 0
for i in range(len(s)):
    if(my_index(lis, s[i], -1)>=0): 
        cnt += 1
        
    else:
        maxcnt = max(maxcnt, cnt)
        cnt = 0
maxcnt = max(maxcnt, cnt)
print(maxcnt)

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

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

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

Solution (Python):
tmp = input()

out_1 = 0
tmp_s = []
for c in tmp:
        if c == "A" or c == "G" or c == "T" or c == "C":
                tmp_s.append(c)
        else:
                if out_1 < len(tmp_s):
                        out_1 = len(tmp_s)
                tmp_s = []
if out_1 < len(tmp_s):
        out_1 = len(tmp_s)
print(out_1)

Solution (Python):
import re

S = input()
lmax = 0

for i in range(len(S)):
    for j in range(i, len(S)):
        ss = S[i:j+1]
        l = re.findall(r'[^ACGT]', ss)
        if len(l) == 0:
            lmax = max(lmax, len(ss))
        else:
            continue
print(lmax)

Solution (Python):
S = input()
lis_S = list(S)
Ans = []
index = 0
n = 0
for char in lis_S:
    Ans.append(0)
    if char=="A" or char=="C" or char=="G" or char=="T":
        Ans[n] += 1
        index += 1
    elif index < len(lis_S):
        index += 1
        n += 1
        continue
    else:
        break
print(max(Ans))

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