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()
count = 0

while S != "":
	while S[0] != "A" and S[0] != "C" and S[0] !="G" and S[0] !="T":

		S = S[1:]
		if S == "":
			break
	
	if S == "":
		break
	c = 0
	while S[0] == "A" or S[0] == "C" or S[0] =="G" or S[0] =="T":
		c +=1
		if count < c:
			count = c
	

		S = S[1:]

		if S == "":
			break
	
	if S == "":
		break

print(count)

Solution (Python):
from re import sub

word = input()
word_length = []

word = sub('[^ATGC]', ' ', word).split()
for i in word:
    word_length.append(len(i))

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

Solution (Python):
a = input()
answer = 0

a = a.replace("B", "-")
a = a.replace("D", "-")
a = a.replace("E", "-")
a = a.replace("F", "-")
a = a.replace("H", "-")
a = a.replace("I", "-")
a = a.replace("J", "-")
a = a.replace("K", "-")
a = a.replace("L", "-")
a = a.replace("M", "-")
a = a.replace("N", "-")
a = a.replace("O", "-")
a = a.replace("P", "-")
a = a.replace("Q", "-")
a = a.replace("R", "-")
a = a.replace("S", "-")
a = a.replace("U", "-")
a = a.replace("V", "-")
a = a.replace("W", "-")
a = a.replace("X", "-")
a = a.replace("Y", "-")
a = a.replace("Z", "-")

strs = int(a.count("-")) + 1
a = a.split("-")

for i in range(strs):
    if len(a[i]) > answer:
        answer = len(a[i])

print(answer)

Solution (Python):
S = list(input())
k=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':
		k+=1
	else:
		if k>ans:
			ans=k
		k=0
if k>ans:
	ans=k
print(ans)

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

for i  in range(l):
  for j in range(i+1,l+1):
    a=True
    L=s[i:j]
    
    for k in L:
      if k not in lst:
        a=False
        break
    if a:
      ans.append(L)
num=0

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

Solution (Python):
def checkACGT(s):
    for i in range(len(s)):
        if s[i] == "A" or s[i] == "G" or s[i] == "C" or s[i] == "T":
            continue
        else:
            return False
    return True

s=input()
n = len(s)
check = []
check.append(s)
while True:
    if not check:
        print(0)
        break
    if checkACGT(check[0]):
        print(len(check[0]))
        break
    else:
        if len(check[0]) == 1:
            check.pop(0)
            continue
        check.append(check[0][1:])
        check.append(check[0][:len(check[0])-1])
        check.pop(0)

Solution (Python):


s = input()


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

Solution (Python):
string = input()

elements = set(string)

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

for i in ATCGs:
    elements.discard(i)

for i in elements:
    string = string.replace(i, ".")
    
subs = string.split(".")
print(max(map(len, subs)))

Solution (Python):
S = input()
s_list=[]
string= ""
AGCT = ["A", "G", "C", "T"]
for s in S:
    if s in AGCT:
        
        string += s
    else:
        s_list.append(string)
        string=""
s_list.append(string)
print(max(map(len, s_list)))

Solution (Python):
S = input()
s = len(S)
L = []
temp = 0
for i in range(s):
    if S[i]=='A' or S[i]=='T' or S[i]=='G' or S[i]=='C':
        if temp ==0:
            temp=1
            L.append(temp)
        else:
            temp*=10
            L.append(temp)
    else:
        temp = 0
L.append(-1)        
if len(L)==2 and L[0]==0:
    P=0
elif len(L)==1:
    P=0
else:
    P = len(str(max(L)))
print(P)

Solution (Python):
S=input()
U={"A","T","G","C"}
N=len(S)
L=[0]
for i in range(N):
    if S[i] in U:
        L[-1]+=1
    else:
        L.append(0)
print(max(L))

Solution (Python):
import sys
from operator import itemgetter
import collections


def r(s):
    m = 0
    cnt = 0
    for n in s:
        if n in ['A', 'C', 'G', 'T']:
            cnt = cnt + 1
            m = max(m, cnt)
        else:
            cnt = 0
    return m


def main():
    input = sys.stdin.readline
    s = str(input()).strip()

    print(r(s))


if __name__ == '__main__':
    main()

Solution (Python):
seq = input()
index = []
for char in list(seq):
    if char == "A" or char == "T" or char == "C" or char == "G":
        index.append("1")
    else:
        index.append("0")
index2 = ''.join(index)
print(len(max(index2.split("0"))))

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

ans = []
for i in range(len(s)):
  c = 0
  for j in range(i, len(s)):
    if s[j] in t:
      c += 1
    else:
      break
  ans.append(c)

print(max(ans))

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

Solution (Python):
S=input()
all=[]
for i in range(len(S)):
    if S[i]=="A" or S[i]=="C" or S[i]=="G" or S[i]=="T":
        all.append(i)
max=0
test=0
try:
    mae=all[0]
except:
    print("0")
    quit()
del all[0]
for j in all:
    if (j-1)==mae:
        test+=1;
    else:
        max=test
        test=0
    mae=j
else:
    if max<test:
        max=test;
    else:
        pass
print(str(max+1))

Solution (Python):
s = list(input())
list = {"A", "T", "G", "C"}
tmp = 0
count = 0
for i in s:
    count += 1
    if i not in list:
        if count -1 > tmp:
            tmp = count-1
        count = 0
if count > tmp:
    tmp = count
print(tmp)

Solution (Python):
S = input()

not_agct = "BDEFHIJKLMNOPQRSUVWXYZ"

head = 0
tail = 0
length = len(S)

candi = []

for head in range(length):
    for tail in range(length,head,-1):
        candi.append(S[head:tail])        



ans = 0
for txt in candi:
    for judge in txt:
        if judge in not_agct:
            break
    else:
        if ans < len(txt):
            ans = len(txt) 

print(ans)

Solution (Python):
import re

T = input()
max_ = 0
s = re.match('[ACGT]+', T)
if s:
    max_ = len(s.group(0))

s = re.search('[^ACGT][ACGT]+$', T)
if s:
    max_ = max(max_, len(s.group(0)) - 1)


ss = re.findall('[^ACGT][ACGT]+[^ACGT]', T)
if ss:
    for s in ss:
        if s:
            max_ = max(max_, len(s) - 2)
print(max_)

Solution (Python):
a = input()
sum = 0
max = 0
for i in a:
    if i is "A":
        sum += 1
    elif i is "T":
        sum += 1
    elif i is "C":
        sum += 1
    elif i is "G":
        sum += 1
    else:
        if sum > max:
            max = sum
        sum = 0
if max == 0 and sum > 0:
    max = sum
if sum > max:
    max = sum
print(max)

Solution (Python):
def f(x):
    length=0
    array=[]
    for b in x:
        if b==True:
            length+=1
        else:
            array.append(length)
            length=0

    array.append(length)
    return array

s=input()
sb = ['A','C','G','T']
boola=list()
length=0

for x in s:
    boola.append(x in sb)

print(max(f(boola)))

Solution (Python):
b = input()
l = len(b)
ans = []
kotae = 1
c = []
for i in range(l):
  if b[i]=="A" or b[i]=="T" or b[i]=="G" or b[i]=="C":
    ans.append(i)
l2 = len(ans)
if l2==1:
  c.append(1)
for i in range(l2-1):
  if (ans[i+1]-ans[i])==1 and i==l2-2:
    kotae+=1
    c.append(kotae)
  elif (ans[i+1]-ans[i])==1:
    kotae+=1
  else:
    c.append(kotae)
    kotae=1
if ans==[]:
  print(0)
else:print(max(c))

Solution (Python):
from sys import stdin
s = input()
a = []
a.append(s.find('A'))
a.append(s.find('T'))
a.append(s.find('G'))
a.append(s.find('C'))
for i in range(len(a)):
    if a[i] == -1:
        a[i] = 100
start = min(a)

pos = 0
sol = 0
for i in range(start, len(s)):
    
    if s[i] != 'A' and s[i]!='T' and s[i]!='G' and s[i]!='C':
        pos = i
        if pos - start > sol:
            sol = pos - start
        
        a.clear()
        a.append(s.find('A', i))
        a.append(s.find('T', i))
        a.append(s.find('G', i))
        a.append(s.find('C', i))
        for i in range(len(a)):
            if a[i] == -1:
                a[i] = 100
        start = min(a)
if len(s)- start > sol:
    sol = len(s)-start
print(sol)

Solution (Python):
s=-1
S=raw_input()+"!"
ans=0
for i in range(len(S)):
  if S[i]in "ATCG":
    if s==-1:
      s=i
  elif s!=-1:
    ans=max(ans, i-s)
    s=-1
print ans

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

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

def sea(s):
    if s==[]:
        return 0
    max_agct=0
    tem_agct=0
    for i in range(len(s)):
        for j in range(len(s)-i):
            if s[i+j]=="A" or s[i+j]=="G" or s[i+j]=="C" or s[i+j]=="T":
                tem_agct+=1
          
                        
            else:
                if tem_agct>max_agct:
                    max_agct=tem_agct
                tem_agct=0
                break
                
        if i+j==len(s)-1:
            if tem_agct>max_agct:
                max_agct=tem_agct
            break
                    
    return max_agct

print(sea(s))

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

Solution (Python):
S = input()
S_list = list(S)
S_ex = ''.join((['1' if (k == 'A' or k == 'C' or k == 'G' or k == 'T') else '0' for k in S_list]))
S_ans = [len(k) for k in S_ex.split('0')]
print(max(S_ans))

Solution (Python):
S = input()

ACGT = ["", ""]
lenACGT = [0, 0]
idx = 1
for s in S:

    if("A" == s):
        add = 1
    elif("C" == s):
        add = 1
    elif("G" == s):
        add = 1
    elif("T" == s):
        add = 1
    else:
        if("" != ACGT[idx]):
            ACGT.append("")
            lenACGT.append(0)
            idx += 1
        add = 0
        continue
    if(1 == add):
        ACGT[idx] += s
        lenACGT[idx] += 1



print(str(max(lenACGT)))

Solution (Python):
S = input()
N = len(S)
alphabets = "BDEFHIJKLMNOPQRSUVWXYZ"

ans = 0
for width in range(1, N+1):
    for start in range(N-width+1):
        b = True
        char = S[start:start + width]
        
        for al in alphabets:
            if al in char:
                b = False
        if b:
            ans = max(ans, len(char))

print(ans)

Solution (Python):
s = input()
sl = len(s)
dic = {"A":1,"C":1,"G":1,"T":1}
cntmax = 0
for i in range(sl):
    cnt=0    
    for j in range(i,sl):
        try :
            
            cnt += dic[s[j]]
        except KeyError:
            
            if cntmax < cnt:
                
                cntmax = cnt
            break
    if cntmax < cnt:
        cntmax = cnt
print(cntmax)

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

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

Solution (Python):
S = input()

m = [0] * len(S)

for i, s in enumerate(S):
    if s in "AGCT":
        if i == 0:
            m[i] = 1
        else:
            m[i] = m[i-1] + 1
    else:
        m[i] = 0

print(max(m))

Solution (Python):
import re
pattern = r'[ACGT]+'
ans = 0

text = input()
match_list = re.findall(pattern, text)


if match_list:
    match_list_len = [len(x) for x in match_list]
    ans = max(match_list_len)

print(ans)

Solution (Python):
s = input()
k = 0
ans = 0
tmp = -1 * float('inf')
for i in range(len(s)):
  if s[i] == 'A' or s[i] == 'T' or s[i] == 'G' or s[i] == 'C':
    k = k + 1
    if k >= tmp:
      tmp = k
      ans = k
  else:
    k = 0
print(ans)

Solution (Python):
import re

S = input()
max = 0

for i in range(len(S)) :
    for j in range(i + 1, len(S) + 1) :
        pattern = re.compile(r'[A|T|C|G]{%d}' % int(j - i))
        subStr = S[i:j]

        if pattern.match(subStr) and j - i > max :
            max = j - i

print(max)

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

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

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

list.append(cnt)

print(max(list) if list else 0)

Solution (Python):
s = list(input())
l = ["A","T","G","C"]
maxcount = 0
count = 0
flag = False
for i in range(len(s)):
    if s[i] in l:
        flag = True
        if flag:
            count += 1
        if count > maxcount:
            maxcount = count
    else:
        count = 0
        flag = False
print(maxcount)

Solution (Python):
from itertools import product
from collections import Counter

S = input()
ML = len(S)

B = {'A', 'T', 'G', 'C'}
L = 0
for b, e in product(range(ML), repeat=2):
    T = S[b:ML-e]
    cc = Counter(T)
    BB = set(cc.keys()) - B
    if len(BB) == 0 and L < len(T):
        L = len(T)

print(L)

Solution (Python):
s = list(input())
count = [0]*len(s)

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

print(max(count))

Solution (Python):
S = input()
lenS = len(S)
maxl = 0

for i in range(lenS):
    for j in range(i, lenS):

        now = S[i:j+1]

        nowlist = list(now)
        newlist = [n for n in nowlist if n == 'A' or n == 'C' or n == 'G' or n == 'T']
        if len(newlist) == len(nowlist):
            maxl = max(maxl, len(now))
print(maxl)

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


def not_acgt(s):
    for c in s:
        if c not in ACGT:
            return False

    return True


def main():
    S = input()

    results = []
    
    for i in range(len(S)):
        for j in range(len(S)):
            if not_acgt(S[i:j+1]):
                results.append(S[i:j+1])
            
    try:
        print(max([len(s) for s in results]))
    except Exception:
        print(0)


if __name__ == "__main__":
    main()

Solution (Python):

s=list(input())



for i in range(len(s)):
    if s[i]=="A" or s[i]=="T" or s[i]=="G" or s[i]=="C":
        s[i]=1
    else:
        s[i]=0
list_s=[]
for i in range(len(s)):
    flag=1
    for j in range(len(s)-i):
        if s[i+j]==0:
            list_s.append(j)
            flag=0
            break
    if flag:
        list_s.append(len(s)-i)

print(max(list_s))

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

Solution (Python):
import sys
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()
 
s = ns()
a = 0
b = 0
for i in range(len(s)):
  if s[i] in "ATCG":
    b += 1
  else:
    if b > 0:
      a = max(a,b)
      b = 0
 
print(max(a,b))

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

ans = 0
for i in range(length):
    s_ = S[i:]
    for j in range(length, -1, -1):
        
        if j == 0:
            s = s_
        else:
            s = s_[:-j]

        valid = True
        for x in s:
            if x not in ['A', 'C', 'G', 'T']:
                valid = False
                break
        if valid:
            ans = max(ans, len(s))

print(ans)

Solution (Python):
base_chars = set("ACGT")

max_len = 0
tmp_len = 0
for c in input().strip():
  if c in base_chars:
    tmp_len += 1
  else:
    max_len = max(max_len, tmp_len)
    tmp_len = 0
max_len = max(max_len, tmp_len)
print(max_len)

Solution (Python):
b = input()
ans = ""

for i in range(len(b)):
    if b[i] == "A" or b[i] == "T" or b[i] == "C" or b[i] == "G":
        ans += "1"
    else:
        ans += "0"


ls = ans.split("0")

print(len(max(ls)))

Solution (Python):
S = input()

max_str = 0
counter = 0

for s in S:
  if s == 'A' or s == 'C' or s == 'G' or s == 'T':
    counter += 1
    max_str = max(max_str, counter)
  else:
    counter = 0

print(max_str)

Solution (Python):
s = input()
n = len(s)
i = 0
a = 0
while i<n:
    c,j = 0,i
    while j < n:
        t = (s[j:j+1])
        if t == "A" or t == "C" or t == "G" or t == "T":
            j += 1
            c += 1
        else:
            if c > a:
                a = c
            break
    if j==n:
        if c > a:
            a = c
    i = j+1
print(a)

Solution (Python):
S = input()
a = []
b = 0

for i in range(len(S)):

    if S[i] == 'A' or S[i] == 'T' or S[i] == 'G' or S[i] == 'C':

        b += 1

    else:

        a.append(b)
        b = 0

a.append(b)

print(max(a))

Solution (Python):
count = 0;
maxnum=0;
s = input();

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

maxnum = max(count,maxnum);
print(maxnum);

Solution (Python):
L = ['A', 'C', 'G', 'T']
S = list(input())
M = 0
current = 0
for x in S:
    if x in L:
        current += 1
        M = max(M, current)
    else:
        current = 0
print(M)

Solution (Python):
s = input()
def check(a):
    ALLOWED = "ACGT"
    for c in a:
        if not c in ALLOWED:
            return False
    return True

ans = 0
for i in range(len(s)):
    for j in range(1, len(s) - i + 1):
        tmp = s[i: i + j]
        if check(tmp):
            ans = max(ans, len(tmp))
print(ans)

Solution (Python):
S=input()

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

print(ans)

Solution (Python):
import re
N = input()
l = []

for m in re.finditer(r"[ATCG]+", N, re.MULTILINE):
    g_counts = len(m.group())
    l.append(g_counts)

if len(l) != 0:
    print(max(l))
else:
    print(0)

Solution (Python):
S = input()

ATGC = ['A','T','G','C']
count = 0
goukei = []
for i in range(len(S)):
	count = 0
	for j in range(i,len(S)):
		if(S[j] in ATGC):
			count += 1
			if(j == len(S)-1):
				goukei.append(count)
				break
		else:
			goukei.append(count)
			break
print(max(goukei))

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

def judge1(S):
  for j in range(len(S)):
    judge = 1
    if((S[j]=='A')or(S[j]=='G')or(S[j]=='T')or(S[j]=='C')):
      continue
    else:
      judge = 0
      break
  return judge 

ans = 0
judge = 0
for i in range(len(S)):
  j = 0
  k = len(S) - i
  
  while(1):
   if(j+k-1 > len(S)-1):
    break
   tmp_S = S[j:j+k]
   judge = judge1(tmp_S)
   if(judge == 1):
    ans = len(tmp_S)
    break
   j += 1
  if(judge == 1):
    break
      
print(ans)

Solution (Python):
S = input()
rules = set(("A", "C", "G", "T"))

long = 0
result = -1
for s in S:
    if s in rules:
        long += 1
    else:
        result = max(result, long)
        long = 0
result = max(result, long)        
print(result)

Solution (Python):
S = input()

text = ""
ans = 0
for idx, moji in enumerate(S):
    
    if moji == "A" or moji == "C" or moji == "G" or moji == "T":
        text += moji
        for j in range(idx+1,len(S)):
            if S[j] == "A" or S[j] == "C" or S[j] == "G" or S[j] == "T":
                text += S[j]
                
            else:
                
                if len(text) > ans:
                    ans = len(text)
                text = ""
                break
        if len(text) > ans:
            ans = len(text)
        text = ""
    else:
        text = ""

print(ans)

Solution (Python):

"""
Created on Sun Mar 24 21:18:05 2019

@author: yuta
"""

S = input()

def main(s):
    max_count = 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:
            continue
        for j in range(1,len(s)-i):
            if s[i+j] == "A" or s[i+j] == "T" or s[i+j] == "G" or s[i+j] == "C":
                count += 1
            else:
                break
        if max_count <= count:
            max_count = count
    print(max_count)
main(S)

Solution (Python):
S = input()
maxLength = 0
length = 0


for s in S:
    if s == 'A' or s == 'C' or s == 'G' or s == 'T':
        length += 1
    else:
        length = 0
    if maxLength < length:
        maxLength = length

print(maxLength)

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

li = []
result = []
pre = 0
n=0

for i in s:
	n=n+1
	if pre == 0 and (i == "A" or i == "C" or i == "G" or i == "T"):
		li.append(i)
		pre=1
		if n == len(s):
			if len(li)>len(result):
				result = li
	elif pre == 1 and (i == "A" or i == "C" or i == "G" or i == "T"):
		li.append(i)
		if n == len(s):
			if len(li)>len(result):
				result = li
	elif pre==1:
		if len(li)>len(result):
			result = li
		li=[]
		pre=0

print(len(result))

Solution (Python):

b = input()
ans = 0
kari = 0
flag = True
for i in range(len(b)):
    
    if b[i] == "A" or b[i] == "T" or b[i] == "C" or b[i] == "G":
        if flag == True:
            kari += 1
            ans = max(kari,ans)
        else:
            kari = 1
            ans = max(kari,ans)
        flag = True
    else:
        
        flag = False
print(ans)

Solution (Python):
S = input()
count = 0
list = []

for c in S:
  if c == 'A' or c == 'C' or c == 'G' or c == 'T':
    count+=1
  else:
    list.append(count)
    count = 0
list.append(count)

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

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

S = input()
T = set()
xx=ptn.match("FAFA")
for i in range(len(S)):
  for j in range(len(S)):
    x = ptn.match(S[i:i+j+1])
    if(x.group(0)):
      T.add(len(x.group(0)))
try:
  print(max(T))
except:
  print(0)

Solution (Python):
s=list(input())
n=len(s)
ans=0
tmp=-10
cnt=[0]*20
for i in range(n):
    if s[i]=="A" or s[i]=="C" or s[i]=="G" or s[i]=="T":
        cnt[i]=1
for i in cnt:
    if i==1:
        ans+=1
    else:
        if tmp<ans:
            tmp=ans
            ans=0
if tmp==-10:
    print(ams)
else:
    print(tmp)

Solution (Python):
s = input()
len(s)
ans = 0
for i in range(len(s)):
    for j in range(len(s) - i):
        part = s[i:j+i+1]
        
        
        
        for car in part:
            if car is not "A" and car is not "T" and car is not "C" and car is not "G":
                break
        else:
            if ans < len(part):
                ans = len(part)
                moji = part
            
            
            

print(ans)

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

T=""
for i in S:
    if i=="A" or i=="C" or i=="G" or i=="T":
        T+="1"
    else:
        T+="0"

TT=T.split("0")
num=0
for i in TT:
    num=max(num,len(i))
print(num)

Solution (Python):
inp = list(input())
li = ['A','C','G','T']
co = []
count = 0
for i in inp:
    if i in li:
        count += 1
    else:
       co.append(count)
       count = 0

co.append(count)
co.sort()
print(co[-1])

Solution (Python):
s = input()
r = 0
o = [x for x in s]

l = 1
j = []
a, b = 0, 1
for y in range(len(o)):
    for x in range(10):
        j.append([a, b])
        a += 1
        b += 1
    l += 1
    a, b = 0, l

for x in j:
    for y in o[x[0]:x[1]]:
        if not y in ["A", "C", "G", "T"]:
            break
    else:
        if len("".join(o[x[0]:x[1]])) > r:
            r = len("".join(o[x[0]:x[1]]))

print(r)

Solution (Python):
S=input()
count = 0
for i in reversed(range(len(S))):
    for j in range(0, len(S)-i):
        S_part = S[j:i+j+1]
        l = list(set(S_part))
        l.sort()
        if set(l)&set(['A','C','G','T'])==set(l):
            count = max(count, len(S_part))
print(count)

Solution (Python):
S = input()

targets = list("AGCT")
out = 0
count = 0
for s in S:
    if s in targets:
        count += 1
    else:
        out = max(out, count)
        count = 0

out = max(out, count)
print(out)

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

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

Max = 0
s = []
t = 0
for i in range(len(S)):
  if S[i] in ACGT:
    t += 1
    if t > Max:
      Max = t
  else:
    t = 0
print(Max)

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

Solution (Python):
s = input()


s = s+'X'
ans = []
cnt = 0
for i in range(len(s)):
  
  if (s[i] != 'A') and (s[i] != 'T') and (s[i] != 'C') and (s[i] != 'G'):
    ans.append(cnt)
    
    cnt = 0
  elif s[i] == 'A':
    cnt += 1
    continue
  elif s[i] == 'T':
    cnt += 1
    continue
  elif s[i] == 'C':
    cnt += 1
  elif s[i] == 'G':
    cnt += 1


print(max(ans))

Solution (Python):
acgtlist = ["A","C","G","T"]
acgtlen,old_acgtlen = 0,0
for i in input():
	if i in acgtlist:
		acgtlen += 1 
	else:
		acgtlen = 0

	old_acgtlen = acgtlen if acgtlen > old_acgtlen else old_acgtlen
print(old_acgtlen)

Solution (Python):
import re
word = input()
cnt = 0
max = 0

for w in word:
    if w == "A" or w == "C" or w == "G" or w == "T":
        cnt += 1
        if cnt > max:
            max = cnt
    else:
        cnt = 0
print(max)

Solution (Python):
S=input()
l=['A','T','C','G']
c=[]
for i in range(len(S)):
    c.append(0)
    for j in S[i:]:
        if (j in l):
            c[-1] += 1
        else:
            break
print(max(c))

Solution (Python):


i = input()

c = 0
c_list = []

if len(i) == 1:
    if i in ['A', 'C', 'G', 'T']:
        print(1)
        exit()
    else:
        print(0)
        exit()

for moji in i:
    if moji in ['A', 'C', 'G', 'T']:
        c += 1
        c_list.append(c)
    else:
        c_list.append(c)
        c = 0

print(max(c_list))

Solution (Python):
s = input()

def atgc(l, r):
    global s
    for i in range(l, r):
        if s[i] != "A" and s[i] != "T" and s[i] != "G" and s[i] != "C":
            return False
    return True

t_max = 0

for i in range(0, len(s) + 1):
    for j in range(i + 1, len(s) + 1):
        if atgc(i, j) and t_max < j - i:
            t_max = j - i
            
print(t_max)

Solution (Python):
S=input()
slist=[]
for i in range(len(S)):
    for j in range(i+1, len(S)+1):
        slist.append(S[i:j])
ma=0
for s in slist:
    flag = True
    for w in s:
        if w not in ['A','C','G','T']:
            flag = False
    if flag:
        ma = max(ma, len(s))
print(ma)

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

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

for i in range(len(s)):
    current_str = s[i:]

    for j in reversed(range(1, len(current_str) + 1)):
        acgt_count = 0
        acgt_count += current_str[:j].count('A')
        acgt_count += current_str[:j].count('G')
        acgt_count += current_str[:j].count('C')
        acgt_count += current_str[:j].count('T')

        if acgt_count == len(current_str[:j]):
            max_acgt_len = max(max_acgt_len, acgt_count)
print(max_acgt_len)

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


def makeIntMatrix(lines):
    intMatrix = []
    for a in makeStringMatrix(lines):
        intMatrix += [int(b) for b in a]
    return intMatrix


def makeStringMatrix(lines):
    stringMatrix = [line.split() for line in lines]
    return stringMatrix


def makeInt(line):
    return int(line.rstrip())


def makeMultiInteger(line):
    return [int(x) for x in line.rstrip().split()]


def solve(input_string):
    S = input_string
    cnt = 0
    maxCnt = 0
    for N in S:
        if N == 'A':
            cnt += 1
        elif N == 'T':
            cnt += 1
        elif N == 'G':
            cnt += 1
        elif N == 'C':
            cnt += 1
        else:
            if cnt > maxCnt:
                maxCnt = cnt
            cnt = 0
        if cnt > maxCnt:
            maxCnt = cnt
    return maxCnt


def main():
    input_lines = stdin.readline()
    answer = solve(input_lines)
    print(answer)


if __name__ == '__main__':
    main()

Solution (Python):
def func1(x):
    if x == 'A':
        num = 1
    elif x == 'T':
        num = 1
    elif x == 'C':
        num = 1
    elif x == 'G':
        num = 1
    else:
        num = 0
    return num

x = list(input())

ans = [0,0,0,0,0,0,0,0,0,0,0,0,0,0]
j = 0
for i in range(len(x)):
    z = func1(x[i])
    if z == 1:
        ans[j] += 1
    else:
        j += 1
        continue

print(max(ans))

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

acgt = ['']
while len(s) != 0:
	if s[0] == 'A' or s[0] == 'C' or s[0] == 'G' or s[0] == 'T':
		acgt[-1] += s.pop(0)
	else:
		s.pop(0)
		acgt.append('')

print(max([len(e) for e in acgt]))

Solution (Python):
word = input()
num = [0]
index = 0
for i in word:
  if i.strip("ATCG") == "":
    num[index] += 1
  else:
    index += 1
    num.append(0)
print(max(num))

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

Solution (Python):
def main():
    s = input()
    is_prev_atgc = False
    now = 0
    maximum = 0
    target = ("A", "T", "G", "C")
    for char in s:
        if char in target:
            is_prev_atgc = True
            now += 1
            if maximum < now:
                maximum = now
        else:
            is_prev_atgc = False
            now = 0
    print(maximum)
if __name__ == "__main__":
    main()

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