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):
def ABC122B():
    S = input()
    target = ['A', 'G', 'C', 'T']
    flag = False
    cnt = 0
    ans = 0
    for s in list(S):
        if s in target:
            cnt += 1
            if flag == False:flag = True
        if flag == True and s not in target:
            flag = False

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

ABC122B()

Solution (Python):
s = list(input())
x = []
for i in s:
    if i in ('A' 'C' 'G' 'T'):
        x.append(1)
    else:
        x.append(0)

z = len(x)
y = [0]
a = 1
if z == 1:
    if x[0] == 1:
        y.append(a)
else:
    for j in range(1,z):
        if x[j] == 1:
            if x[j-1] == 1:
                a += 1
                if j == z-1:
                    y.append(a)
            else:
                y.append(a)
                a = 1
        else:
            if x[j-1] == 1:
                y.append(a)
                a = 1
print(max(y))

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

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


z = len(x)
y = [0]
a = 1
if z == 1:
    if x[0] == 1:
        y.append(a)
else:
    for j in range(1,z):
        if x[j] == 1:
            if x[j-1] == 1:
                a += 1
                if j == z-1:
                    y.append(a)
            else:
                y.append(a)
                a = 1
        else:
            if x[j-1] == 1:
                y.append(a)
                a = 1

print(max(y))

Solution (Python):
s = input()

count = 0
result = 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
  else:
    if result < count:
      result = count
      count =0

if result < count:
  result = count

print(result)

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

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

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

for t in T:
    if t in ACGT:
        count += 1
        ans = max(ans, count)
    else:
        count = 0

print(ans)

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

Solution (Python):
def main():
    result = []
    strings = ["A", "T", "G", "C"]
    S = input()
    tmp = 0
    for s in S:
        if s in strings:
            tmp += 1
        else:
            result.append(tmp)
            tmp = 0
    result.append(tmp)
    print(max(result))


if __name__ == '__main__':
    main()

Solution (Python):
"""
author : halo2halo
date : 9, Jan, 2020
"""

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

S = readline().decode('utf8').rstrip()
L = len(S)
ans = 0
for left in range(L):
    for right in range(left, L):
        T = S[left:right + 1]
        if set(T) <= set('ACGT'):
            ans = max(ans, right - left + 1)

print(ans)

Solution (Python):
"""
author : halo2halo
date : 9, Jan, 2020
"""

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

AT = {'A', 'C', 'G', 'T'}
S = list(read().decode('utf8').rstrip())

lis = [0] * len(S)
for s in range(len(S)):
    if S[s] in AT:
        if lis[s - 1] != 0:
            lis[s] += lis[s - 1] + 1
        else:
            lis[s] = 1
    else:
        lis[s] = 0

print(max(lis))

Solution (Python):
import sys

atcg = set('ATCG')

s = sys.stdin.readline().rstrip()

def main():
    t = s + '$'
    l = len(t)
    res = 0
    cnt = 0
    for i in range(l):
        if t[i] in atcg:
            cnt += 1
        else:
            res = max(res, cnt)
            cnt = 0
    return res

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    S = input()
    ACGT = set(['A', 'C', 'G', 'T'])

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

if __name__ == '__main__':
    main()

Solution (Python):
s = input()

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

if (c >= 0):
   ans.append(len(s) - c)
try:
   print(max(ans))
except:
   print(0)

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

Solution (Python):
S = input()

ans = 0 
ans_lis = [0]

for i in range(len(S)):
    if S[i] in "ACGT":
        ans = ans + 1 
    else:
        ans_lis.append(ans)
        ans = 0 

ans_lis.append(ans)
print(max(ans_lis))

Solution (Python):
S = input()

ans = 0 
ans_lis = [0]

for i in range(len(S)):
    if S[i] in "ACGT":
        ans = ans + 1 
        if i == (len(S)-1):
            ans_lis.append(ans)
    else:
        ans_lis.append(ans)
        ans = 0 

print(max(ans_lis))

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

ans = 0 
ans_lis = [0]

for i in range(len(S)):
    if S[i] in ACGT:
        ans = ans + 1 
        if i == (len(S)-1):
            ans_lis.append(ans)
    elif S[i] not in ACGT:
        ans_lis.append(ans)
        ans = 0 

print(max(ans_lis))

Solution (Python):
import re

s = input()
ans = max(
    map(len, re.findall('[AGCT]+', s)),
    default=0
)

print(ans)

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

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

Solution (Python):
S = input()

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

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

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

ans =[]
cnt = 0
for i in s:
    if i in DNA:
        cnt += 1
        if i == s[-1]:
            ans.append(cnt)
    else:
        ans.append(cnt)
        cnt = 0

print(max(ans))

Solution (Python):

 
import math
import itertools
import sys
import copy
 





S = str(input())

T = "ACGT"

S2 = ""
for i in range(len(S)) :
  if S[i] in T :
    S2 += "
  else :
    S2 += " "
S3 = list(map(str, S2.split()))

l = 0
for i in range(len(S3)) :
  l = max(l, len(S3[i]))
  
print (l)

Solution (Python):
s=input()
l=["A","C","G","T"]
ans=[]
cnt=0
for i in s:
	if i in l:
		cnt+=1
		if i==s[-1]:
			ans.append(cnt)
	else:
		ans.append(cnt)
		cnt=0

print(max(ans))

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

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

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

Solution (Python):
S = str(input())
ans = [0]
for i in range(len(S)):
    for k in range(i,len(S)):
        if all("ACGT".count(c)==1 for c in S[i:k+1]):
            ans.append(len(S[i:k+1]))
print(max(ans))

Solution (Python):
import sys
import math
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

s = ns()
ans = 0
c = 0
acgt = ["A", "C", "G", "T"]
for si in s:
    if si in acgt:
        c += 1
    else:
        ans = max(c, ans)
        c = 0
if c != 0:
    ans = max(c, ans)
print(ans)

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

Solution (Python):
s = input().strip()
ans = 0
tmp = 0
for _, x in enumerate(s):
    if x == "A" or x == "C" or x == "G" or x == "T":
        tmp += 1
    else:
        ans = max(ans, tmp)
        tmp = 0

if tmp != 0:
    ans = max(ans, tmp)
print(ans)

Solution (Python):
S = input()

d = set(['A', 'T', 'C', 'G'])
len_ = 0
ans = 0
for s in S:
    if s in d:
        len_ += 1
    else:
        
        
        
        ans = max(len_, ans)
        len_ = 0
ans = max(len_, ans)
print(ans)

Solution (Python):
S = input()

d = set(['A', 'T', 'C', 'G'])
len_ = 0
ans = 0
for s in S:
    if s in d:
        len_ += 1
    else:
        if len_ > ans:
            ans = len_
        len_ = 0
if len_ > ans:
    ans = len_
print(ans)

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

Solution (Python):
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input():
    return sys.stdin.readline().rstrip()

def main():
    S=list(input())
    ans=0
    tmp=0
    for s in S:
        if s=='A' or s=='T' or s=='G' or s=='C':
            tmp+=1
        else:
            ans=max(ans,tmp)
            tmp=0
    ans=max(ans,tmp)
    print(ans)

if __name__ == '__main__':
    main()

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

Solution (Python):
s = input()

res = []

for i in range(len(s)):
    for j in range(i, len(s)):
        check = s[i:j+1]
        if len(check) == check.count("A")+check.count("T")+check.count("C")+check.count("G"):
            res.append(len(check))
print(0 if res == [] else max(res))

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

ans = ""
tmp_ans = ""
for i in range(len(s)):
    if re.fullmatch(r"[ATGC]", s[i]):
        tmp_ans += s[i]
    else:
        if len(ans) < len(tmp_ans):
            ans = tmp_ans
        tmp_ans = ""

if len(ans) < len(tmp_ans):
    ans = tmp_ans

print(len(ans))

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

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

acgt = ''
for s in S:
    if s not in data:
        acgt += '.'
    else:
        acgt += s

ans = 0
for s in acgt.split('.'):
    ans = max(ans, len(s))
print(ans)

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

Solution (Python):

S = list(str(input()))

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

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

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

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

Solution (Python):
a=str(input())
count=0
ans=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:
        ans=max(ans,count)
        count=0
ans=max(ans,count)  
print(ans)

Solution (Python):
S = input()
code = ["A","C","G","T"]
mask = [None] * len(S)
ans = 0
temp = 0

for el in S:
    if el in code:
        temp += 1
    else:
        ans = max(ans,temp)
        temp = 0
ans = max(temp, ans)
print(ans)

Solution (Python):
def main():
	
	
	s = list(str(input()))
	
	
	
	
	avoid = 0
	ans = 0
	ans_rec = []
	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:
			ans_rec.append(ans)
			ans = 0
	ans_rec.append(ans)
			
	print(max(ans_rec))

 
if __name__ == '__main__':
	main()

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

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

Solution (Python):
from itertools import groupby
S = input()
d = {"A", "C", "G", "T"}
print(max(map(lambda p: int(p[0])*len(list(p[1])), groupby(S, lambda s: s in d))))

Solution (Python):
s = input()
l = []
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
    else:
        l.append(count)
        count = 0
    if i == len(s)-1:
        l.append(count)

print(max(l))

Solution (Python):
import sys

S = list(input())

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

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

Solution (Python):
s=[i for i in input()]
l=[]
cnt=0
for i in range(len(s)):
  if s[i] in {"A","T","C","G"," "}:
    cnt+=1
    if i==len(s)-1:
      l.append(cnt)
  else:
    l.append(cnt)
    cnt=0    
print(sorted(l)[-1])

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

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

a = (re.split('[BDEFHIJKLMNOPQRSUVWXYZ]', S))

A = []

for i in a:
    A.append(len(i))
print(max(A))

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

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

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

K = ('A', 'C', 'G', 'T')
for i in range(len(S)):
    cnt = 0
    if S[i] not in K:
        continue
    else:
        cnt += 1
    for j in range(i+1, len(S)):
        if S[j] not in K:
            break
        cnt += 1
    if ans < cnt:
        ans = cnt

print(ans)

Solution (Python):
s = input()
lst = [0]

for i in range(len(s)):

    if s[i] in 'ACGT':
        tmp = 0
        for j in range(len(s)-i):
            if s[i+j] in 'ACGT':
                tmp += 1
            else:
                break

            lst.append(tmp)


print(max(lst))

Solution (Python):
S = str(input())
S_list = list(S)
S_switch = []

for i in range(len(S_list)):
    if S_list[i]=="T" or S_list[i]=="A" or S_list[i]=="G" or S_list[i]=="C":
        S_switch.append(1)
    else:
        S_switch.append(0)

count = 0
max_count = 0
for i in range(len(S_switch)):
    if S_switch[i] == 1:
        count = count + 1
    else:
        if count > max_count:
            max_count = count
        count = 0

if count > max_count:
    max_count = count
count = 0

print(max_count)

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

Solution (Python):
s = input()
ret = 0
for left in range(len(s)):
    for right in range(left, len(s)):
        if set(s[left:right + 1]).issubset(set('ACGT')):
            ret = max(ret, right - left + 1)
print(ret)

Solution (Python):
S = input()

n = 0

ans = 0

counter = 0

while n != len(S):
    if S[n] == 'A' or S[n] == 'C' or S[n] == 'T' or S[n] == 'G':
        counter += 1
    else:
        counter = 0
    if ans < counter:
        ans = counter
    n += 1

print(ans)

Solution (Python):
s = input()
tmp = ''
for i in s:
	if i not in 'ACGT':
		tmp += '-'
	else:
		tmp += i
print (max(len(i) for i in tmp.split('-')))

Solution (Python):
import os, sys, re, math

(S) = input()

max_len = 0
for i in range(0, len(S)):
    for j in range(i + 1, len(S) + 1):
        substr = S[i:j]
        if len(re.sub('[ATGC]', '', substr)) == 0:
            max_len = max(max_len, len(substr))

print (max_len)

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

print(ret)

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

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

Solution (Python):
from sys import stdin


def fetch_one_line():
    return stdin.readline().rstrip()


def fetch_int_input():
    return [int(s) for s in fetch_one_line().split()]


def fetch_inputs(times):
    return [fetch_one_line() for _ in range(times)]


def fetch_int_inputs(times):
    return [[int(s) for s in fetch_one_line()] for _ in range(times)]


S = fetch_one_line()
is_ACGT = []
ACGT = "A C G T".split()

for s in S:
    is_ACGT.append(s in ACGT)

longest = -1
count = 0
for b in is_ACGT:
    if b:
        count += 1
    else:
        if count > longest:
            longest = count
            count = 0


if count > longest:
    longest = count

print(longest)

Solution (Python):
s = input()

st = 'ACGT'
ans = 0
cur = 0
for x in s:
  if x in st:
    cur += 1
  else:
    cur = 0
  ans = max(cur, ans)
print(ans)

Solution (Python):
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7


S = sys.stdin.buffer.readline().decode().rstrip()
N = len(S)
ans = 0
for l in range(N + 1):
    for r in range(N + 1):
        if re.match(r'^[AGCT]*$', S[l:r]):
            ans = max(ans, r - l)
print(ans)

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

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

max = 0
for i in range(len(s)):
    for j in reversed(range(len(s) + 1)):
        cnt = 0
        for k in range(i, j):
            if s[k] == "A" or s[k] == "C" or s[k] == "G" or s[k] == "T":
                cnt += 1
            else:
                cnt = 0
                break
        if max < cnt:
            max = cnt
print(max)

Solution (Python):


S = input()

ans = 0
for i in range(len(S)):
    tmp = 0
    if S[i] in ('A', 'C', 'G', 'T'):
        tmp += 1
        for j in range(i + 1, len(S)):
            if S[j] in ('A', 'C', 'G', 'T'):
                tmp += 1
            else:
                i = j
                ans = max(tmp, ans)
                break
        ans = max(tmp, ans)

print(ans)

Solution (Python):
S = list(input())
S.append('fuck')
lis = ['A','T','C','G']
count = 1 if S[0] in lis else 0
ans = 1 if S[0] in lis else 0
for i in range(1,len(S)):
  if S[i] in lis:
    count += 1
  else:
    ans = max(ans,count)
    count = 0
print(ans)

Solution (Python):
import re

S = input()

ans = 0
for s in re.findall(r"[ACGT]+", S):
    ans = max(ans, len(s))

print(ans)

Solution (Python):
def solve():
    S = input()
    
    N = len(S)
    ans, i = 0, 0
    while i < N:
        count = 0
        j = i
        while j < N:
            if S[j] == 'A' or S[j] == 'C' or S[j] == 'G' or S[j] == 'T':
                count += 1
                j += 1
            else:
                break
        i = j + 1
        ans = max(ans, count)
    print(ans)


if __name__ == '__main__':
    solve()

Solution (Python):
S = input()

import re
list_s = re.findall("[ACGT]*", S)
print( max( map( len , list_s ) ) )

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

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

Solution (Python):
S = list(input())
targ = 'ACGT'

ans = 0
ans_tmp = 0
for i, Si in enumerate(S):
    if Si in targ:
        ans_tmp += 1
    else:
        ans = max(ans, ans_tmp)
        ans_tmp = 0
else:
    ans = max(ans, ans_tmp)

print(ans)

Solution (Python):
A, = [s.split() for s in open(0)]
if len(A) == 0:
    A = [""]
else:
    A = A[0]
acgt = []
for i in range(len(A)):
    for j in range(len(A), 0, -1):
        sub_string = A[i:j]
        for s in sub_string:
            if s not in ["A", "C", "G", "T"]:
                break 
        else:
            acgt.append(sub_string)
if len(acgt) == 0:
    print(0)
else:
    print(max([len(s) for s in acgt]))

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

for i in list(s):
    if i in ("A","C","G","T"):
        cnt += 1
    else:
        if cnt > maxacgt:
            maxacgt = cnt
        cnt = 0
else:
    if cnt > maxacgt:
            maxacgt = cnt
    ans = maxacgt

print(ans)

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

ans = [0]
count = 0

for i in s:
    if i in acgt:
        count += 1
    else:
        ans.append(count)
        count = 0
ans.append(count)

print(max(ans))

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

Solution (Python):
S = input()
ltrs = "ACGT"
curr_max = 0
curr_len = 0
for ltr in S:
    if ltr in ltrs:
        curr_len += 1
    else:
        curr_max = max(curr_max, curr_len)
        curr_len = 0
print(max(curr_len, curr_max))

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

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

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

ans = []
ll = 0
for i in range(len(S)):
    if S[i] in AA:
        ll += 1
    else:
        ans.append(ll)
        ll = 0
ans.append(ll)

print(max(ans))

Solution (Python):
import re
s = input()
max_re = 0
for i in range(len(s)):
    tar_s = s[i:]
    tar_s = re.search(r'(A|T|C|G)*', tar_s).group()
    max_re = max(max_re, len(tar_s))
print(max_re)

Solution (Python):

s = input()
max_cnt = 0
cnt = 0
for v in s:
  if v in ['A', 'T', 'C', 'G']:
    cnt += 1
  else:
    max_cnt = cnt if max_cnt < cnt else max_cnt
    cnt = 0

max_cnt = cnt if max_cnt < cnt else max_cnt
print(max_cnt)

Solution (Python):
s = input()
acgt = 'ACGT'
res = 0
cnt = 0

for a in s:
    cnt += 1
    if not a in acgt:
        cnt = 0
    res = max(res, cnt)
print(res)

Solution (Python):
S = input()
S=S.replace("T","A")
S=S.replace("G","A")
S=S.replace("C","A")
for i in range(10,-1,-1):
  if S.find("A"*i) != -1:
    print(i)
    break

Solution (Python):
S=list(input())
S.append("X")
i=0
ans=0
for j in range(len(S)):
  if S[j]!="A" and S[j]!="T" and S[j]!="C" and S[j]!="G":
    ans=max(ans,len(S[i:j]))
    i=j+1
print(ans)

Solution (Python):
import sys
from collections import Counter
s=list(input())
ls = list("ATGC")
a=[]
for i in range(len(s)):
  if s[i] in ls:
    a.append(i)
if a == []:
  print(0)
  sys.exit()
for i in range(len(a)):
  a[i] -= i+1
c=Counter(a)
print(c.most_common(1)[0][1])

Solution (Python):
import sys

input = sys.stdin.readline

ri = lambda: int(input())
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in range(n)]
rsls = lambda n: [rsl() for _ in range(n)]

s = rs()
res = [0] * len(s)
for i, c in enumerate(s):
    if c in 'ACGT':
        if i > 0:
            res[i] = res[i - 1] + 1
        else:
            res[i] = 1
print(max(res))

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

Solution (Python):
a=input()
ans=[0]
for i in range(len(a)+1):
    for j in range(i,len(a)+1):
        s=a[i:j]
        if set(s)<=set('ACGT'):
            ans.append(len(s))
print(max(ans))

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

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

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

cnt = 0
ans = 0
for i in s:
    
    if (i in Lists):
        cnt += 1
    else:
        cnt = 0

    if (ans < cnt):
        ans = cnt

print(ans)

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

Solution (Python):
s = input()
for i in s:
    if i not in "ACGT":
        s = s.replace(i, "1")
s = s.split("1")
print(len(max(s, key=len)))

Solution (Python):
s = input()

count = 0
Max = 0
for i in s:
    if i in "ACGT":
        count += 1
        Max = max(Max, count)
    else:
        count = 0
print(Max)

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

Solution (Python):
s = list(input())
l = ["A","T","C","G"]
ans=[0]
t = 0
for i in s:
    if  i in l:
        t += 1
    else:
        ans.append(t)
        t = 0
else:
    ans.append(t)

print(max(ans))

Solution (Python):
import sys, os
import collections

def solve(input_stream):
  line = input_stream.readline().strip()
  start = 0
  end = 1
  ans = 0
  while end < len(line) + 1:
    target = line[end - 1]
    if target in ["A", "C", "G", "T"]:
      ans = max(ans, end - start)
      end += 1
    else:
      start = end
      end += 1
  return [str(ans)]

if __name__ == "__main__":
    outputs = solve(sys.stdin)
    for line in outputs:
      print(line)

Solution (Python):
S = input()
ACTG = ["A","C","T","G"]
TF = [False]*len(S)
for i,s in enumerate(S):
    if s in ACTG:
        TF[i] = True
cnt = 0
ans = 0
for tf in TF:
    if tf:
        cnt+=1
    else:
        cnt = 0
    ans = max(ans,cnt)
print(ans)

Solution (Python):
s=input()
l=list(s)
m=0
for i in range(len(l)):
    if l[i]!="A" and l[i]!="T" and l[i]!="C" and l[i]!="G":
        l[i]="."

ss="".join(l)
ll=ss.split(".")
lll=[0]
for i in ll:
    lll.append(len(i))
print(max(lll))

Solution (Python):
import re
res = 0
tmp = 0
for s in input():
    if re.search('[ACGT]', s):
        tmp += 1
    else:
        res = max(res, tmp)
        tmp = 0
res = max(res, tmp)
print(res)

Solution (Python):
s=input()
ret=0
now=0
for c in s:
  if 'ATCG'.count(c)!=0:
    now+=1
  else:
    now=0
  ret=max(now,ret)
print(ret)

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

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

n=len(S)
l=list("ACGT")
ans=[]

for i in range(n):
  count=0
  for j in range(i,n):
    if S[j] in l:
      count+=1
    else:
      break
  ans.append(count)
print(max(ans))

Solution (Python):
S = input()
L = len(S)
answer = 0
for left in range(L):
  for right in range(left,L):
    T = S[left:right+1]
    if set(T) <= set('ACGT'):
      answer = max(answer,right-left+1)

print(answer)

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

Solution (Python):
S = input()
d = ['A','T','G','C']
l = len(S)
acgt = []
a = ''
for i in range(l):
    if S[i] in d:
        a = a + S[i]
        if i == l-1:
            acgt.append(a)
    else:
        acgt.append(a)
        a = ''

max = 0
for a in acgt:
    if len(a) > max:
        max = len(a)
print(max)

Solution (Python):
def p_b():
    s = input()
    s = s.replace("A", ".").replace("T", ".").replace("C", ".").replace("G", ".")
    ans = 0
    tmp = 0
    for e in s:
        if e != ".":
            ans = max(ans, tmp)
            tmp = 0
        else:
            tmp += 1
    ans = max(ans, tmp)
    print(ans)
    
p_b()

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

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

Solution (Python):
a = "ATGC"

inp = input()

ans = 0

for i in range(len(inp)):
	if inp[i] in a:
		cnt, j = 0, i
		while j < len(inp) and inp[j] in a:
			cnt += 1
			j += 1
		ans = max(ans, cnt)

print(ans)

Solution (Python):
S = input()

ans = 0
ACGT = ("A", "C", "G", "T")

count = 0
count_list = [0]
for s in S:
    if s not in ACGT:
        count_list.append(count)
        count = 0
        continue
    else:
        count += 1
count_list.append(count)
print(max(count_list))

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