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

lst = []
for i in range(0, len(S)):
    for k in range(0, len(S)):
        if i > k:
            pass
        else:
            lst.append(S[i:k+1])
lst.append("")
lst_AGCT = []
for i in range(len(lst)):
    if "B" in lst[i] or "D" in lst[i] or "E" in lst[i] or "F" in lst[i] or "H" in lst[i] or "I" in lst[i] or "J" in lst[i] or "K" in lst[i] or "L" in lst[i] or "M" in lst[i] or "N" in lst[i] or "O" in lst[i] or "P" in lst[i] or "Q" in lst[i] or "R" in lst[i] or "S" in lst[i] or "U" in lst[i] or "V" in lst[i] or "W" in lst[i] or "X" in lst[i] or "Y" in lst[i] or "Z" in lst[i]:
        pass
    else:
        lst_AGCT.append(lst[i])

if lst_AGCT == [""]:
    print(0)
else:
    print(len(max(lst_AGCT, key=len)))

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

print(ans)

Solution (Python):
s=list(input())+['Z']
ACGT=['A','C','G','T']
t=[]
count=0
for i in s:
    if i in ACGT:
        count+=1
    else:
        t.append(count)
        count=0

if len(t)==0:
    print(len(s))
else:
    print(max(t))

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

Solution (Python):
b = input()
templist = [0,0,0,0,0,0,0,0,0,0,0,0,0,0]
temp = 0
index = 0
for i in b:
    if i == "A" or i == "C" or i == "G" or i == "T":
        temp = temp + 1
        templist[index] = 1 + templist[index]
    else:
        temp = 0  
        index = index + 1

print(max(templist))

Solution (Python):
def AGCT(x):
    if x=='A':
        return True
    elif x=='G':
         return True
    elif x =='C':
        return True 
    elif x=='T':
        return True
    else:
        return False

S = list(input())
Ans = [0]
flag = 0
i_new =0
ans = 0
for i in range(len(S)):
    ans = 0
    flag = 0
    if AGCT(S[i])==True:
        ans += 1
        i_new = i
        while flag ==0:
            i_new += 1
            if i_new >len(S)-1:
                Ans.append(ans)
                flag = 1
            elif AGCT(S[i_new])!=True:
                Ans.append(ans)
                flag = 1
            else:ans += 1

print(max(Ans))

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

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

Solution (Python):
m = 0
c = 0
for s in input().strip():
    if s in "AGCT":
        c += 1
        if c > m:
            m = c
    else:
        c = 0
print(m)

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

Solution (Python):
import re
S = str(input())
ans = 0
for i in re.findall('[ACGT]*', S):
    if ans < len(i):
        ans = len(i)
print(ans)

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

Solution (Python):
s = input()

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

def findLength(index):
    length = 0
    for c in s[index:]:
        if c in arr:
            length +=1
        else:
            break
    return length

max_length = 0
for i in range(0, len(s)):
    L = findLength(i)
    max_length = max(max_length, L)
    

print(max_length)

Solution (Python):

S = input()
enki = ["A", "T", "G", "C"]
a = []
ans = ""
max_ = 0
for i in range(len(S)):
    if S[i] in enki:
        ans += S[i]
    else:
        ans = ""
    a.append(ans)
    max_ = max(max_, len(ans))
print(max_)

Solution (Python):
s=list(input())
count=[0]*5
j=0
for i in s:
  if(i=="A" or i=="T" or i=="C" or i=="G"):
    count[j]=count[j]+1
  else:
    j=j+1
print(max(count))

Solution (Python):


S = input()
lst = [c for c in S]

le = len(lst)

for i in range(0,le):
    if lst[i] == "A" or lst[i] == "C" or lst[i] == "G" or lst[i] == "T":
        lst[i] = 1
    else:
        lst[i] = 0

ans = 0
ans_sub = 0
for i in range(0,le):
    if lst[i] == 1:
        ans_sub += 1
        if ans_sub >= ans:
            ans = ans_sub
    else:
        if ans_sub >= ans:
            ans = ans_sub
        ans_sub = 0

        

print(ans)

Solution (Python):
row = input()
lenght = len(row)
max_moji = 0
for i in range(lenght):
    if row[i] in 'ACGT':
        moji = 1
        for j in range(i + 1, lenght):
            if row[j] in 'ACGT':
                moji += 1
            else:
                break
        max_moji = moji if moji > max_moji else max_moji
    if max_moji == lenght - i:
        break
print(max_moji)

Solution (Python):
a = input()
a=a.replace("T","A")
a=a.replace("C","A")
a=a.replace("G","A")

for i in range(len(a)+1):
  if  "A"*i in a:
    max=i
print(max)

Solution (Python):
s = input().rstrip()
max_cnt=0
cnt=0
for al in s:
	if al not in "ACGT":
		cnt = 0
	else:
		cnt += 1
		max_cnt = max(max_cnt,cnt)

max_cnt = max(max_cnt,cnt)
print(max_cnt)

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

print(answer)

Solution (Python):
import re

data = input()

t = re.split('[^ACGT]+', data)
t.sort(key=len, reverse=True)
print(len(t[0]))

Solution (Python):
import re
print(max(list(map(len, re.compile(r'[A|G|C|T]*').findall(input())))))

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

Solution (Python):
S = input()

ns = [0]
n = 0

for s in S:
    if s in 'ACGT':
        n += 1
    else:
        ns.append(n)
        n = 0
ns.append(n)

print(max(ns))

Solution (Python):
import re
S = input()
L = len(S)
mlen = 0

match = re.findall('[ATGC]+', S)

for m in match:
    if len(m) > mlen:
        mlen = len(m)
print(mlen)

Solution (Python):

import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)


def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(S):
    ans = 0
    tmp = 0
    targ = 'ACGT'
    for c in S:
        if c in targ:
            tmp += 1
        else:
            ans = max(ans, tmp)
            tmp = 0
    ans = max(ans, tmp)
    return ans


def main():
    S = read_str()
    print(slv(S))


if __name__ == '__main__':
    main()

Solution (Python):
S = input()

AGCT = {"A", "G", "C", "T"}

j = 0
l = 0
l_log = []

while j < len(S):
    if S[j] in AGCT:
        l += 1
        if j == len(S) - 1:
            l_log.append(l)
    else:
        l_log.append(l)
        l = 0
    j += 1

print(max(l_log))

Solution (Python):
S = input()
sum = 0
maxsum = 0
for i in range(len(S)):
    if S[i] in "ACGT":
        sum +=1
    else:
        if maxsum < sum:
            maxsum = sum
        sum = 0
if maxsum < sum:
    maxsum = sum
print(maxsum)

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

Solution (Python):
S = input()
S_list = list(S)
answers = []
acgt = 0
for s in S_list:
    if s == 'A' or s == 'C' or s == 'G' or s == 'T':
        acgt += 1
    else:
        answers.append(acgt)
        acgt = 0
answers.append(acgt)
if answers:
    print(max(answers))
else:
    print(acgt)

Solution (Python):
a = "ACGT"
c = 0
m = 0
s = input()

for x in s:
    if x in a:
        c += 1
        if c > m:
            m = c
    else:
        c = 0

print(m)

Solution (Python):
import sys
import numpy as np
sys.setrecursionlimit(20000000)
input = sys.stdin.readline
s = input()
ans = 0
tmp = 0
for i in range(len(s)):
        if s[i] in ["A","T","C","G"]:
                tmp += 1
        else:
                ans = max(ans,tmp)
                tmp = 0
ans = max(ans,tmp)
print(ans)

Solution (Python):
N = input()
charlist = list(N)
hoge = 0
maxscore = 0
def onon(char, hogehoge):
    nowscore = 0
    while char[hogehoge] == "A" or char[hogehoge] == "T" or char[hogehoge] == "G" or char[hogehoge] == "C" :
        hogehoge = hogehoge + 1
        nowscore += 1
        if hogehoge  >= len(char):
            break
    return nowscore 
for i in charlist:
    score = 0
    if i == "A" or i == "T" or i == "G" or i == "C"  :
        score = onon(charlist,hoge)
    if maxscore <= score:
        maxscore = score
    hoge = hoge + 1
print(maxscore)

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()
acgt = ['A', 'C', 'G', 'T']
max_length = 0

length = 0
for target in s:
	if target in acgt:
		length += 1
		if max_length < length:
			max_length = length
	else:
		length = 0

print(max_length)

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

Solution (Python):
S = input()

maxLen = 0
maxCnt = 0
lstString = ["A" ,"T" ,"C" ,"G"]
for i in range(len(S)):
  if S[i] in lstString:
    maxCnt = 0
    for j in range(i, len(S)):
      if S[j] in lstString:
        maxCnt += 1
      else:
        
        break
    maxLen = max(maxLen, maxCnt)


print(maxLen)

Solution (Python):
s = input()
c = False
for l in range(10):
    l = 10 - l
    sl = [s[i:i+l] for i in range(len(s)-l+1)]
    for w in sl:
        if set(w).issubset(set("AGCT")):
            c = True
            print(l)
            break
    else:
        continue
    break
if not c:
    print(0)

Solution (Python):

"""
Created on Sun Mar 24 20:27:19 2019

@author: screamLab
"""

s = input()
s += 'H'
atcg = ['A','T','C','G']
ans = 0
long = 0
for i in range(len(s)):
    if s[i] in atcg:
        if i == len(s):
            break
        if s[i+1] in atcg:
            ans += 1
        else:
            ans += 1
            long = max(long,ans)
            ans = 0
long = max(long,ans)
print(long)

Solution (Python):
S = input()
list_atgc = ["A", "C", "G", "T"]
demand_list = []
for i in range(len(S)):
    if S[i] in list_atgc:
        j = 0
        string_k = ""
        while True:
            if S[i+j] in list_atgc:
                string_k += S[i+j]
                demand_list.append(string_k)
                j += 1
                if i + j >= len(S):
                    break
            else:
                break
if demand_list:
    print(len(max(demand_list, key=len)))
else:
    print(0)

Solution (Python):
s = input()

result = []
result_1 = ["A","C","G","T"]
end = False
sum = 0

for i in range(len(s)):
    temporary = i
    sum = 0
    while True:
        if end == True:
            break
        for x in result_1:
            try:
                if s[temporary] == x:
                    sum += 1
                    temporary += 1
                    break
            except:
                end = True
        else:
            result.append(sum)
            break

print(max(result))

Solution (Python):



S = input()

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

max_len = 0
tmp_len = 0
for c in S:
    if c in ACGT:
        tmp_len += 1
    else:
        tmp_len = 0
    
    if tmp_len > max_len:
        max_len = tmp_len

print(max_len)

Solution (Python):
S = input()

T = ["A", "C", "G", "T"]
max_length = 0

for start in range(len(S)):
    for end in reversed(range(len(S) + 1)):
        checked = False
        if start > end:
            break
        else:
            sub_str = S[start:end]
            check_str = (
                sub_str.replace("A", "")
                .replace("C", "")
                .replace("G", "")
                .replace("T", "")
            )

            if len(check_str) != 0:
                checked = True
            else:
                if max_length < len(sub_str):
                    max_length = len(sub_str)

print(max_length)

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):
S = list(input())

b = 0

ans = [0]

for n, i in enumerate(S, 1):
  if (i == 'A' or i == 'G' or i == 'C' or i == 'T'):
    b += 1
  else:
    b = 0
  ans.append(b)
print(max(ans))

Solution (Python):
tmp = input()

char_list = list()
acgt_list = list()
max_acgt = list()
acgt = ["A", "C", "G", "T"]
for char in tmp:
  if char in acgt:
    acgt_list.append(char)
    if len(max_acgt) < len(acgt_list):
      max_acgt = acgt_list
  else:
    if len(max_acgt) < len(acgt_list):
      max_acgt = acgt_list
    acgt_list = list()
print(len(max_acgt))

Solution (Python):

S = str(input())
box = ["A", "G", "C", "T"]
s = str()
ACGTbox = str()
for i in range(0, len(S)):
    for j in range(i, len(S)):
        if S[j] in box:
            s += S[j]
        else:
            break
    if len(s) > len(ACGTbox):
        
        ACGTbox = s 
    s = str()
print(len(ACGTbox))

Solution (Python):
s = list(input())
t = [i for i in range(len(s)) if s[i] not in ["A","T","G","C"]]
if len(t) == 0:
	print(len(s))
else:
  t = t + [len(s)]
  u = 0
  w = -1
  for i in range(len(t)):
    if u <= t[i]-w:
      u = t[i]-w
    w = t[i]
  print(u-1)

Solution (Python):
s=input()
ans=0
acgt="ACGT"
for i in range(0,len(s)):
  for j in range(i+1,len(s)+1):
    x=s[i:j]
    z=sum([ y in acgt for y in x])
    if z==j-i:
      ans=max(ans,z)
      
print(ans)

Solution (Python):
s=raw_input()
longest=0
cur=0
for c in s:
    if c in 'ACGT':
        cur+=1
    else:
        longest=max(longest, cur)
        cur=0
print(max(longest, cur))

Solution (Python):
S = input();
answer_max=0;
answer=0;

for i in S:
    if(i=="A" or i=="C" or i=="G" or i=="T"):
        answer+=1;
    else:
        answer=0;
    if(answer_max < answer):
        answer_max = answer;

print(answer_max);

Solution (Python):


if __name__ == '__main__':
    s = input()
    b = 0
    m = 0
    for i in range(len(s)):
        if not (s[i] in "AGTC"):
            if m < i-b:
                m = i-b
            b = i+1
    if m < len(s)-b:
        m = len(s)-b
    print(m)

Solution (Python):
def longest_acgt(t):
    helix = ["A","C","G","T"]
    length = 0
    max_length = 0
    for c in t:
        if c in helix:
            length += 1
        else:
            if max_length < length:
                max_length = length
                length = 0
    if max_length < length:
        max_length = length
    return max_length


t = input()
print(longest_acgt(t))

Solution (Python):


s= input()
slist= list(s)
alist= []

def fun1(i):
    target= slist[i]
    if i==len(s)-1:
        if slist[i]=='A' or slist[i]=='C' or slist[i]=='G' or slist[i]=='T':
            return 1
        else:
            return 0
    elif slist[i]=='A' or slist[i]=='C' or slist[i]=='G' or slist[i]=='T':
        return fun1(i+1)+1
    else:
        return 0

for i in range(len(slist)):
    alist.append(fun1(i))

print(max(alist))

Solution (Python):
""" AtCoder """

S = input()

ans = 0
ans_max = 0
l = ['A', 'C', 'G', 'T']
check = 1

for i in S:
    if i in l:
        ans += 1
    else:
        ans_max = max(ans_max, ans)
        ans = 0
        check = 0

ans_max = max(ans_max, ans)

if check == 1:
    ans_max = len(S)

print(ans_max)

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

Solution (Python):
S = list(input())
ACGT = []
tmp = ""
for i, s in enumerate(S):
    if s == "A" or s == "C" or s == "G" or s == "T":
        tmp += s
        if i == len(S)-1:
            ACGT.append(tmp)
            break
    else:
        ACGT.append(tmp)
        tmp = ""

print(len(sorted(ACGT, key=lambda x: len(x))[len(ACGT)-1]))

Solution (Python):
S = input()
max_len = 0
for i in range(len(S)):
    for j in range(i+1, len(S)+1):
        s = S[i:j]
        s = s.replace('A', '.')
        s = s.replace('T', '.')
        s = s.replace('G', '.')
        s = s.replace('C', '.')
        flag = True
        for ss in s:
            if ss != '.':
                flag = False
        if flag:
            if max_len < len(s):
                max_len = len(s)
print(max_len)

Solution (Python):
S = input()
L=len(S)
longest=0
for i in range(L):
  for j in range(i+1):
    DUP=S[j:i+1]
    DUP=DUP.replace("A","
    DUP=DUP.replace("T","
    DUP=DUP.replace("G","
    DUP=DUP.replace("C","
    count=0
    for a in range(len(DUP)):
      if DUP[a]=="
        count+=1
      else:
        break
    else:
      longest=max(longest,count)
print(longest)

Solution (Python):
import re
S = input()
H = re.findall("[ACGT]+", S)
max_length = 0
for h in H:
	if max_length < len(h):
		max_length = len(h)
print(max_length)

Solution (Python):
def is_ATCG(str):
    for i in range(len(str)):
        chr=str[i]
        if(not(chr=='A' or chr=='T' or chr == 'C' or chr=='G')):
            return 0
    return 1

i_str=input()
max_len=0
len_str=len(i_str)

for i in range(len_str): 
    for j in range(i,len_str): 
        strA=i_str[i:j+1:1]
        if max_len < len(strA) and is_ATCG(strA):
            max_len = len(strA)
print(max_len)

Solution (Python):
import re

pattern = "[ATCG]+"
S = input()
result = re.findall(pattern, S)
S_len = map(len, result)
try:
  print(max(S_len))
except:
  print(0)

Solution (Python):
S=str(input())  
S=S.replace("A","x")
S=S.replace("T","x")
S=S.replace("G","x")
S=S.replace("C","x")
for i in range(0,2,1):
  if S.count("xxxxxxxxxx")!=0:
    print(10)
    break
  elif S.count("xxxxxxxxx")!=0:
    print(9)
    break
  elif S.count("xxxxxxxx")!=0:
    print(8)
    break
  elif S.count("xxxxxxx")!=0:
    print(7)
    break
  elif S.count("xxxxxx")!=0:
    print(6)
    break
  elif S.count("xxxxx")!=0:
    print(5)
    break
  elif S.count("xxxx")!=0:
    print(4)
    break
  elif S.count("xxx")!=0:
    print(3)
    break
  elif S.count("xx")!=0:
    print(2)
    break
  elif S.count("x")!=0:
    print(1)
    break
  else:
    print(0)
    break

Solution (Python):
from sys import stdin

str = stdin.readline().rstrip()


cnt = 0
rslt = 0




for a in str:
    flg = 0
    for b in "ATGC":
        if a == b:
            cnt = cnt + 1
            flg = 1
            break
            
    
    if rslt <= cnt:
        rslt = cnt
        
    if flg == 0:
        cnt = 0


print(rslt)

Solution (Python):
S = input()
acgt = ["A","C","G","T"]
S_tf = [any([sss == aaa for aaa in acgt]) for sss in S]
maxlen = 0
curlen = 0
for i in S_tf:
    if i:
        curlen += 1
        if maxlen < curlen:
            maxlen = curlen
    else:
        curlen = 0
print(maxlen)

Solution (Python):
s = input().strip()
agct = ['A', 'G', 'C', 'T']
counter = 0
counts = [0]

for c in s:
    if c in agct:
        counter += 1
    else:
        if max(counts) < counter:
            counts.append(counter)
        counter = 0


counts.append(counter)

print(max(counts))

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

for i in range(l):
    for j in range(l-i+1):
        seq = S[i:i+j]
        seq2 = seq.replace("A","").replace("G","").replace("T","").replace("C","")
        if seq2 == "":
            ans = max(ans, len(seq))
print(ans)

Solution (Python):
def tasu(i):
    global bubun
    if i >= len(string):
        return
    elif string[i] == "A" or string[i] == "C" or string[i] == "G" or string[i] == "T":
        bubun += string[i]
        tasu(i + 1)

string = input()

lst = [""]

for i in range(len(string)):
    if string[i] == "A" or string[i] == "C" or string[i] == "G" or string[i] == "T":
        bubun = ""
        tasu(i)
        lst.append(bubun)

print(len(max(lst, key=len)))

Solution (Python):
s = input()
max = 0
oldmax = 0
for e in s:
    if(oldmax < max):
        oldmax = max
    if (e == "A" or e == "T" or e == "G" or e == "C"):
        max += 1
        if(oldmax < max):
            oldmax = max
    else:
        max = 0
print(oldmax)

Solution (Python):
s = input()
s2 = ''
for c in s:
    if c in ('A','T','C','G'):
        s2 += '1'
    else:
        s2 += '0'


tmp = 0
ret = 0
for c in s2:
    if c == '1':
        tmp += 1
    else:
        ret = max(ret, tmp)
        tmp = 0
ret = max(ret, tmp)
print(ret)

Solution (Python):

moji = list(input())
n = len(moji)
kaunto = 0
risuto = []
for i in range(n):
    if (moji[i] == "A") or (moji[i] == "G") or (moji[i] == "C") or (moji[i] == "T"):
        risuto.append("X")
    else:
        risuto.append(" ")

s = 0
kotae = []
for i in risuto:
    if i == "X":
        s += 1
        kotae.append(s)
    else:
        s = 0
if kotae != []:
    print(int(max(kotae)))
else:
    print(0)

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

Solution (Python):
b, = map(str, input().split())

alpha = [chr(ord('A') + i) for i in range(26)]
acgt = ["A","C","G","T"]
for i in acgt:
    alpha.remove(i)

for i in alpha:
    b = b.replace(i," ")
    words = b.split(" ")
    
const = 0
length = 0

for word in words:
    const = len(word)
    if const>length:
        length = const

print(length)

Solution (Python):
s = input()
def check(substr):
    ret = 0
    for i in range(len(substr)):
        if substr[i] !='A' and substr[i] !='C' and substr[i] != 'G' and substr[i] !='T':
            return 0
        else:
            ret +=1
    return ret
ans = 0
for i in range(len(s)):
    for j in range(i,len(s)+1):
        sub = s[i:j]
        ans = max(ans, check(sub))
print(ans)

Solution (Python):

import sys



def solve(lines):
    S = lines.pop(0)
    c = 0
    res = 0
    for i in S:
        if i in 'AGCT':
            c += 1
        else:
            c = 0
        res = max(res, c)
    print(res)

lines = [x.strip() for x in sys.stdin.readlines()]




solve(lines)

Solution (Python):
import re

s = input()
table = str.maketrans({'A': 'a', 'T': 't', 'G': 'g', 'C': 'c'})
result = s.translate(table)


result = re.sub(r'[A-Z]', " ", result)
s_list = result.split()
m = 0
for ss in s_list:
    m = max(m, len(ss))
    

print(m)

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


s1 = s.replace("A","1")
s2 = s1.replace("G","1")
s3 = s2.replace("T","1")
s4 = s3.replace("C","1")

if s4.count("1111111111") >= 1:
 print(10)
elif s4.count("111111111") >= 1:
 print(9)
elif s4.count("11111111") >= 1:
 print(8)
elif s4.count("1111111") >= 1:
 print(7)
elif s4.count("111111") >= 1:
 print(6)
elif s4.count("11111") >= 1:
 print(5)
elif s4.count("1111") >= 1:
 print(4)
elif s4.count("111") >= 1:
 print(3)
elif s4.count("11") >= 1:
 print(2)
elif s4.count("1") >= 1:
 print(1)
else:
 print(0)

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

input_len = len(input)
cnt = 0
max_cnt = 0
for i,s in enumerate(input):
    if s in acgt:
        cnt += 1
    elif cnt > max_cnt:
        max_cnt = cnt
        cnt = 0
    else:
        cnt = 0

    if i == input_len - 1 and cnt > max_cnt:
        max_cnt = cnt

print(max_cnt)

Solution (Python):
S = input()
countermax = 0
counter = 0
for s in S:
    if s == 'A' or s == 'C' or s == 'G' or s == 'T':
        counter += 1
    else:
        if countermax < counter:
            countermax = counter
            counter = 0
if countermax < counter:
    countermax = counter

print(countermax)

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

Solution (Python):
S = input()

subStringList = [S]
length = len(S)

counter = 0
before = 1

while (not(counter == before)):
    before = counter
    for s in subStringList[:]:
        for letter in s:
            if (not(letter in "ATGC")):
                subStringList += s.split(letter)
                subStringList.remove(s)
                counter = len(subStringList)
                break

print(len(max(subStringList,key=len)))

Solution (Python):
s=list(input())
counts=0
lists=[]
a=len(s)
for i in range (1,a+1):
    if s[i-1]=='A':
        counts=counts+1
        lists.append(counts)
    elif s[i-1]=='G':
        counts=counts+1
        lists.append(counts)
    elif s[i-1]=='T':
        counts=counts+1
        lists.append(counts)
    elif s[i-1]=='C':
        counts=counts+1
        lists.append(counts)
    else:
        counts=0
lists.sort()
k=len(lists)
if k==0:
    print(0)
else:
    print(lists[k-1])

Solution (Python):
def main():
    s = input()
    n = len(s)
    output = 0

    ss = s.replace("A", "1").replace("T", "1").replace("G", "1").replace("C", "1")

    for i in range(n + 1):
        if "1" * i in ss:
            output = i

    print(output)
    return 0


if __name__ == '__main__':
    main()

Solution (Python):
s = input()
count,ans = 0,0

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

Solution (Python):
S = list(input())
m = 0
count = 0
for i in range(len(S)):
    for j in range(i, len(S)):
        count = 0
        
        for s in list(S[i:j+1]):
            
            if s in ['A', 'G', 'T', 'C']:
                count += 1
            else:
                if m <= count:
                    m = count
                count = 0
                switch = True
            if m <= count:
                m = count


print(m)

Solution (Python):
S = input()
S = S +'R'

count = 0
j=0
num=[]
for i in range(len(S)):
    
    
    
    
    
    

    if S[i] == 'A' or S[i]=='T' or S[i]=='C' or S[i]== 'G':
        count=count+1
        
       
    else:
        num.append(count)
        j=j+1
        count=0



max_num=max(num)
print(max_num)

Solution (Python):
sss = str(input())
ss_list = []

for i in range(len(sss)):
    for j in range(i,len(sss)+1):
        ss_list.append(sss[i:j])
ss_list = list(set(ss_list))



def bh(ss):
    flag = 0
    for s in ss:
        if s not in ["A","G","T","C"]:
            flag = 1
    if flag == 0:
        return len(ss)
    else:
        return 0

max_len = 0
for ss in ss_list:
    l = bh(ss)
    if l>max_len:
        max_len = l

print(max_len)

Solution (Python):
b = input()
let = 'ATGC'
prev = b[0]
high = 0
leng = 0
stop = False

if prev in let:
    leng = 1
    high = 1
    
for i in range(1,len(b)):
    if leng == 0 and b[i] in let:
        leng = 1
    if b[i] in let and prev in let:
        leng += 1
        stop = False
    else:
        stop = True
        if leng > high:
            high = leng
            leng = 0
    prev = b[i]
    
if not stop:
    if leng > high:
        high = leng
    
print(high)

Solution (Python):
S = list(input())
lst=[]
for i in range(len(S)):
    if S[i]!="A" and S[i]!="C" and S[i]!="T" and S[i]!="G":
        lst.append(i)
lst.insert(0,-1)
lst.append(len(S))
dif=[]
for j in range(len(lst) - 1):
    dif.append(lst[j+1] - lst[j])

ans = max(dif) - 1
print(ans)

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

ans.append(pre)
print(max(ans))

Solution (Python):
S = input()

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

res = 0

for i in range(len(S)+1):
    for j in range(1,len(S)+1):
        flag = True
        if -j+1 == 0:
            
            for k in S[i:]:
                if k not in st:
                    flag = False
                    break
        
            if flag:
                res = max(res,len(S[i:]))
        
        else:
            for k in S[i:-j+1]:
                if k not in st:
                    flag = False
                    break
            
            if flag:
                res = max(res,len(S[i:-j+1]))

print(res)

Solution (Python):
retu = input()
res = list(map(str,retu))
sum = [0]*len(retu)


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

    
for i in range(len(retu)):
  for j in range(len(retu)-i):
    if res[i+j] == 1:
      sum[i] += 1
    else:
      break
      
print(max(sum))

Solution (Python):

S = str(input())

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

count = 0
count_list = []
count_list.append(0)
list_S = list(S)
length = len(list_S)

for i in range(0, length):
  if list_S[i] in acgt_list:
    for j in range(i, length):
      if list_S[j] in acgt_list:
        count += 1
      else:
        count_list.append(count)
        count = 0
        break
      if j == length -1:
        count_list.append(count)
        count = 0
print(max(count_list))