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()
ans=0
for i in range(len(s)):
    for j in range(len(s)):
        new_s=list(s[i:(len(s)-j)])
        if all((i in ["A","T","G","C"]) for i in new_s) and len(new_s)>ans:
            ans=len(new_s)
print(ans)

Solution (Python):
s = input()
c = ["A","C","G","T"]
ans = 0
count = 0
f = False
for i,ss in enumerate(s):
    if i == 0 and s[i] in c:
        count = 1
        f = True
        continue
    if f:
        if s[i] in c:
            count += 1
        else:
            ans = max(count,ans)
            count = 0
            f = False
    else:
        if s[i] in c:
            count += 1
            f = True
ans = max(count,ans)
print(ans)

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

Solution (Python):



















































def calculation(lines):
    line = lines[0]
    
    
    
    
    
    
    
    
    
    

    result = 0
    tmp = 0

    

    for char in line:

        

        if char == 'A':
            flag = True
        elif char == 'C':
            flag = True
        elif char == 'G':
            flag = True
        elif char == 'T':
            flag = True
        else:
            flag = False

        if flag:
            tmp += 1
            
            if result < tmp:
                result = tmp
        else:
            tmp = 0

    return [result]



def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines



def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['ATCODER']
        lines_export = [3]
    if pattern == 2:
        lines_input = ['HATAGAYA']
        lines_export = [5]
    if pattern == 3:
        lines_input = ['SHINJUKU']
        lines_export = [0]
    return lines_input, lines_export



def get_mode():
    import sys
    args = sys.argv
    if len(args) == 1:
        mode = 0
    else:
        mode = int(args[1])
    return mode



def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(1)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    
    
    
    
    
    
    
    
    
    
    



if __name__ == '__main__':
    main()

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

Solution (Python):
words = input()

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

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

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

Solution (Python):
s = input()

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

Solution (Python):
S = input()

ans = 0
for i in range(len(S)):
    for j in range(i, len(S)):
        ok = True
        for k in range(i, j+1):
            if not (S[k] == "A" or S[k] == "C" or S[k] == "G" or S[k] == "T"):
                ok = False
                break
        if ok:
            ans = max(ans, j - i + 1)

print(ans)

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

ans=0
ans1=[]
for x in range(len(s)):
  if s[x]=='A' or s[x]=='T' or s[x]=='G' or s[x]=='C':
    ans+=1
  else:
    ans1.append(ans)
    ans=0
  if x==len(s)-1:
    ans1.append(ans)
    
print(max(ans1))

Solution (Python):
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

s = input()
chk_str = ""
chk = 0
for i in range(len(s)):
    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
        chk_str += s[i]
    else:
        if chk < len(chk_str):
            chk = len(chk_str)
        chk_str = ""
if chk < len(chk_str):
    chk = len(chk_str)
print(chk)

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

def countACGT(s):
  res = 0
  res += s.count("A")
  res += s.count("C")
  res += s.count("G")
  res += s.count("T")
  if res == len(s):
    return res
  else:
    return 0

for i in range(len(S)+1):
  for j in range(len(S)+1):
    RES = max(RES,countACGT(S[i:j]))
print(RES)

Solution (Python):


def main():

    S = input()

    listS = list(S)

    listStr = ['A', 'C', 'G', 'T']
    counter = 0
    flag = False
    ans = 0

    for i in listS:
        if i in listStr:
            counter += 1
            if ans < counter:
                ans = counter
            flag = True

        else:
            flag = False
            counter = 0


    print(ans)


if __name__ == "__main__":
    main()

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

Solution (Python):
import re

S = re.findall('[ACGT]*', input())
print(max([len(s) for s in S]))

Solution (Python):
a=list(input())
m=['A','C','G','T']
result=['']
for i in range(len(a)+1):
    for j in range(i):
        n=a[j:i]
        ans=0
        for k in range(len(n)):
            if n[k]=='A' or n[k]=='C' or n[k]=='G' or n[k]=='T':
                continue
            else:
                ans+=1
        if ans==0:
            result.append(n)
print(len(max(result,key=len)))

Solution (Python):
S = input()

max_len = 0

for i in range(len(S)):
    for j in range(i+1, len(S)+1):
        bs = S[i:j]
        is_acgt = True
        for c in 'BDEFHIJKLMNOPQRSUVWXYZ':
            if c in bs:
                is_acgt = False

        if is_acgt:
            length = len(bs)
            if length > max_len:
                max_len = length

print(max_len)

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

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

print(ans)

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

for i in range(len(S)):
  if S[i] in ["A", "C", "G", "T"]:
    a += 1
    count.append(a)
  else:
    a = 0
    count.append(a)
print(max(list(map(int, count))))

Solution (Python):
s=input()

score=0

for i in range(len(s)):
    for j in range(i,len(s)):
        isbad = 0
        for k in range(i,j+1):
            if s[k] != "A" and s[k] != "C" and s[k] != "G" and s[k] != "T": 
                isbad=1
                break
        if isbad==0:
            score = max(j+1-i,score)
            
        
print(score)

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()
lst=['A','C','G','T']
ans=0
a=0
i=0
while i<len(S):
    if not (S[i] in lst):
        i+=1
    else:
        a=1
        i+=1
        while i<len(S) and S[i] in lst:
            a+=1
            i+=1
    if ans<a:
        ans=a
    a=0
print(ans)

Solution (Python):
S = input()

max_leng = 0
i = 0
while i < len(S):
  count = 0
  while S[i] == 'A' or S[i] == 'C' or S[i] == 'G'or S[i] == 'T':
    count += 1
    i += 1
    if i == len(S):
      break
  if max_leng < count:
    max_leng = count
  i += 1
print(max_leng)

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

Solution (Python):
import sys
read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    S = input()
    count = 0
    ans = 0
    ACGT = ['A','C','G','T']
    for s in S:
        if s in ACGT:
            count += 1
        else:
            ans = max(ans, count)
            count = 0
    ans = max(ans, count)

    print(ans)




if __name__ == '__main__':
    main()

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

ref = ["A","C","G","T"]
lst = []

for i in range(N):
    ans = ""
    if s[i] in ref:
        while s[i] in ref:
            ans = ans + s[i]
            i += 1
            if i >= N:
                break
    lst.append(ans)

ans = -float("inf")
for i in range(N):
    ans = max(ans, len(lst[i]))

print(ans)

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

Solution (Python):


S = input()


N = len(S)
ans = 0
ACGT = ["A", "C", "G", "T"]
for i in range(N):
    if S[i] not in ACGT:
        continue
    length = 1
    for j in range(i + 1, N):
        if S[j] not in ACGT:
            break
        length += 1
    ans = max(ans, length)


print(ans)

Solution (Python):
S = input()

c = 0
m = 0

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

print(m)

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

ans = [0]
count = 0
for n in N:
    if n in ACGT:
        count += 1
    else:
        ans.append(count)
        count = 0
ans.append(count)
print(max(ans))

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

Solution (Python):
S = input()
tf = []
for s in S:
    if s in "ACGT":
        tf.append(True)
    else:
        tf.append(False)

ans = 0
temp = 0
for res in tf:
    if res:
        temp += 1
    else:
        temp = 0
    ans = max(ans, temp)
print(ans)

Solution (Python):
S = input()
L = [0]*len(S)

for n in range(len(S)):
  T = S[n:]
  for t in T:
    if t in "ACGT":
      L[n]+=1
    else:
      break
      
print(max(L))

Solution (Python):
S = input()
n = len(S)
ma = 0
c = 0
for i in range(n):
    for j in range(i,n):
        c = 0
        for k in range(i,j+1):
            if not S[k] in 'ACGT':
                break
            c += 1
        ma = max(ma,c)

print(ma)

Solution (Python):
def abc122_b():
    s = input()
    ans = 0

    
    

    acgt = list('ACGT')

    for i in range(len(s)):
        for j in range(i, len(s)):

            
            if all([x in acgt for x in ｓ[i : j + 1]]):
                
                ans = max(ans, len(ｓ[i : j + 1]))

    print(ans)

if __name__ == '__main__':
    abc122_b()

Solution (Python):

def abc122_b():
    s = input()
    acgt = ['A', 'C', 'G', 'T']

    check = [1 if s[i] in acgt else 0 for i in range(len(s))]

    result = 0
    for i in range(len(check)):
        for j in range(i, len(check)):
            if check[i : j + 1].count(0) == 0:
                if result < len(check[i:j + 1]):
                    result = len(check[i:j + 1])

    print(result)

if __name__ == '__main__':
    abc122_b()

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



ans = 0

for i in range(N):
    for j in range(i, N):
        tf = True
        for k in range(i, j + 1):
            if l[k] == 0:
                tf = False
        if tf == True:
            ans = max(ans, j - i + 1)
print(ans)

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

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

count = 0

word = 0
flag = 0

for j in range(len(n)):
  if(flag == 0):
    if(n[j] == 'A' or n[j] == 'C' or n[j] == 'T' or n[j] == 'G'):
      word += 1
      flag = 1
  else:
    if(n[j] != 'A' and n[j] != 'C' and n[j] != 'T' and n[j] != 'G'):
      if(count < word):
        count = word
      word = 0
      flag = 0
    else:
      word += 1

if(count < word):
  count = word

print(count)

Solution (Python):
s = input()
cnt = 0
mx = 0
ACGT = {"A", "C", "G", "T"}
for i in s:
    if i in ACGT:
        cnt += 1
        mx = max(cnt, mx)
    else:
        cnt = 0
print(mx)

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

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

print(mx)

Solution (Python):
S = input()
N = len(S)
ans = 0
acgt = set(['A','C','G','T'])
for i in range(N):
    for j in range(i,N):
        if all(c in acgt for c in S[i:j+1]):
            ans = max(ans,j-i+1)
print(ans)

Solution (Python):
if __name__ == '__main__':
	
	S = input()
	s_len = len(S)
	s1 = {"A","C","G","T"}
	
	m_len = 0
	for x in range(s_len):
		for y in range(x+1,s_len+1):
			s2 = set(S[x:y])
			s_union =  s1.union(s2)
			if len(s_union) == 4:
				m_len = max(m_len,len(S[x:y]))
	print(m_len)

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

Solution (Python):
def main():
    s = input()
    n = len(s)
    ans = 0
    for i in range(n):
        for j in range(i + 1, n + 1):
            if set(s[i:j]) - {"A", "C", "G", "T"} == set():
                ans = max(ans, len(s[i:j]))
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]





S = input()

cnt = 0
ans = 0
for char in S:
    if char == 'A' or char == 'C' or char == 'G' or char == 'T':
        cnt += 1
    else:
        ans = max(cnt, ans)
        cnt = 0

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

Solution (Python):
S = input()

ma = 0
tmp = 0
acgt = ('A','C','G','T')

for s in S:
    if s in acgt:
        tmp += 1
        ma = max(ma,tmp)
    else:
        tmp = 0
print(ma)

Solution (Python):
s=input()
l=["A","C","G","T"]
ans=0
for i in range(len(s)):
    for j in range(len(s)):
        part=s[i:len(s)-j]
        if all((part[k] in l) for k in range(len(part))) and len(part)>ans:
            ans=len(part)
print(ans)

Solution (Python):
S = input()
tf = []
for s in S:
    if s in "ACGT":
        tf.append(True)
    else:
        tf.append(False)

ans = 0
temp = 0
for res in tf:
    if res:
        temp += 1
    else:
        temp = 0
    ans = max(ans, temp)
print(ans)

Solution (Python):
s = input()
AT = "ACGT"
ans = 0
tmp = 0
for i in range(len(s)):
  if s[i] in AT:
    tmp += 1
  else:  
    ans = max(ans,tmp)
    tmp = 0
    
print(max(ans,tmp))

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

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    s = list(input())
    ans = 0
    for i in range(len(s)):
        count = 0
        for j in range(i, len(s)):
            if s[j] in ['A', 'C', 'G', 'T']:
                count += 1
            else:
                break
        ans = max(ans, count)
    print(ans)
            
if __name__ == '__main__':
    main()

Solution (Python):




s=list(input())
n=len(s)
mx=0
temp=0
l=['A','C','G','T']

for i in range(n):
    for j in range(i,n):
        st=s[i:j+1]
        if all([c in l for c in st]):
            mx=max(mx,j-i+1)
print(mx)

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

Solution (Python):
import sys
import re
S = input()
if not ( 1 <= len(S) <= 10 ): sys.exit()
if not S.isupper: sys.exit()

result = 0
max = max(re.findall('[A|T|G|C]+', S),key=len) if re.findall('[A|T|G|C]+', S) else ''
if len(max) > 0:result = len(max)
print(result)

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")

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

Solution (Python):


S = input()

res = 0
now_mojisu = 0
agct = ["A", "C", "G", "T"]

for i in S:
    if i in agct:
        now_mojisu += 1
    else:
        now_mojisu = 0
    res = max(res, now_mojisu)

print(res)

Solution (Python):
S = input()

ACGT = 'A C G T'.split()
result = 0
tmp = 0
for i in S:
    if i in ACGT:
        tmp += 1
    else:
        tmp = 0
    if tmp > result:
        result = tmp

print(result)

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

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

s = input()

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

print(ans)

Solution (Python):
S = input()

ACGT = ['A', 'C', 'G', 'T']
cntList = []
cnt = 0
cntList.append(cnt)
for s in S:
    if s in ACGT:
        cnt += 1
        cntList.append(cnt)
    else:
        cnt = 0
print(max(cntList))

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

Solution (Python):
S = input()

ACGT = 'ACGT'

count = []
tmp_num = 0
for i in S:
    if i in ACGT:
        tmp_num += 1
    elif i not in ACGT:
        count.append(tmp_num)
        tmp_num = 0
count.append(tmp_num)

print(max(count))

Solution (Python):
def main():
    S = list(input().rstrip())
    for l in reversed(range(1, len(S)+1)):
        for d in range(len(S) - l + 1):
            if set(S[d:d+l]).issubset(set(["A", "C", "G", "T"])):
                print(l)
                exit()
    print(0)


if __name__ == '__main__':
    main()

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

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

print(ans)

Solution (Python):
string = input()
ans = 0
score = 0
ok = set('ACGT')
for c in string:
    if c in ok:
        score += 1
    else:
        ans = max(ans, score)
        score = 0
ans = max(ans,score)
print(ans)

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

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

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

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

l = 0
ans = 0
for c in s:
    if c in ('A', 'C', 'G', 'T'):
        l += 1
        ans = max(ans, l)
    else:
        l = 0
print(ans)

Solution (Python):
s = input()

ans = 0

for l in range (len(s)):

  for r in range(l+1, len(s)+1):

    cnt = 0

    for str in s[l:r]:

      if str not in ['A','C','G','T']:

        cnt = 0 

        break

      else:

        cnt += 1

    ans = max(ans, cnt)

print(ans)

Solution (Python):

S = input()
N = len(S)
mozi = ["A","C","G","T"]
cou = 0
Max = 0
n = 0
for i in range(N):
    for j in mozi:
        if S[i] == j:
            cou += 1
            n += 1
        if j == "T" and n == 0:
            if cou > Max:
                Max = cou
            cou = 0
        elif j == "T":
            n = 0
        
if cou > Max:
    Max = cou
print(Max)

Solution (Python):



S = input()
N = len(S)

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

Solution (Python):
import sys
sys.setrecursionlimit(10**6)

s = input()

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

ans = 0
tmp = 0

for ch in s:
    if ch in l:
        tmp += 1
    else:
        ans = max(ans, tmp)
        tmp = 0
ans = max(ans, tmp)
        
print(ans)

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

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

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

ans = 0
for i in range(N):
    for j in range(i, N):
        if all("ACTG".count(s) == 1 for s in S[i:j+1]):
            ans = max(ans, j - i + 1)

print(ans)

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

Solution (Python):
s = input()

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

print(ans)

Solution (Python):
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

s = S()

temp = 0
ans = 0

for char in s:
    if char in 'ACGT':
        temp += 1
    else:
        temp = 0
    ans = max(ans,temp)
print(ans)

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

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

Solution (Python):
S = input()

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

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

for i in range(n):
  for j in range(n):
    p = s[i : j + 1]
    if all(c in l for c in p):
        ans.append(len(p)) 
print(max(ans))

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

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

print(ans)

Solution (Python):
S = input()
ans = 0
for i in range(len(S)):
    for j in range(i, len(S)):
        c = True
        for k in range(i, j+1):
            if S[k]!='A' and S[k]!='C' and S[k]!='G' and S[k]!='T':
                c = False
        if c and ans < j-i+1:
            ans = j-i+1
print(ans)

Solution (Python):
S = input()

s = []

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

ans = 0
if len(s) == 1:
    ans = 1

count = 1
for i in range(len(s)-1):
    if s[i] + 1 == s[i+1]:
        count += 1
    else:
        count = 1
    if ans < count:
        ans = count
print(ans)

Solution (Python):
s = input()

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

print(max(max_cnt, cnt))

Solution (Python):
S = input()

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

print(ans)

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

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

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

Solution (Python):
import sys

s=str(input())
ans=0
tmp=0
for i in range(len(s)):
    if s[i]=='A' or  s[i]=='G' or s[i]=='C' or  s[i]=='T':
        tmp+=1
        ans=max(ans,tmp)
    else:
        tmp=0

print(ans)

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

Solution (Python):
s=input()
n=len(s)
a=[0]*n
for i in range(n):
  if s[i] in 'ATCG':a[i]=a[i-1]+1
  else:a[i]=0
print(max(a))

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

Solution (Python):
def resolve():
    S = str(input().split())
    ans = 0

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

    print(ans)
    return

resolve()

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

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

count_list = []
for i in range(len(S)):
    count = 0
    for j in range(i, len(S)):
        if S[j] in ACGT:
            count += 1
        else:
            break
    count_list.append(count)

print(max(count_list))

Solution (Python):
S = input()
MAX = 0
ATGC = ['A','T','G','C']
for T in range(0,len(S)):
    if S[T] in ATGC:
        Count = 1
        for TT in range(T+1,len(S)):
            if S[TT] in ATGC:
                Count += 1
            else: break
        if Count>MAX: MAX = Count
print(MAX)

Solution (Python):
S = input()
code = ["A", "T", "G", "C"]
w_count = 0
count = 0
for i in range(0,len(S)):
    if S[i] in code:
        w_count = w_count + 1
    else:
        if (count <= w_count): count = w_count
        w_count = 0

if (count <= w_count): count = w_count
print(count)

Solution (Python):
s = input()

acgt = ("A","C","G","T")
max_len = 0

for i in range(len(s)):
  t_max = 0
  for c in s[i:]:
    if c not in acgt:
      break
    t_max += 1
  max_len = max(t_max,max_len)

print(max_len)

Solution (Python):
import re;print(max(len(i)for i in re.split('[^ACTG]',input())))

Solution (Python):

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

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

Solution (Python):
S=input()

l=len(S)

ans=0
ans_list=[]

for i in range(l):
    if S[i] in ("A","G","C","T"):
        ans+=1
    else:
        ans_list.append(ans)
        ans=0
ans_list.append(ans)
print(max(ans_list))

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

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

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

Solution (Python):
import re
print(len(max("".join(re.sub(r"[^ATCG]", " ", input())).split(" "), key=lambda x: len(x))))

Solution (Python):
import re
S = re.sub(r"[^ATCG]", " ", input())
S = "".join(S).split(" ")
print(len(max(S, key=lambda x: len(x))))

Solution (Python):
S = list(input())
for i in range(len(S)):
    if S[i] not in "ATCG":
        S[i] = " "
S = "".join(S).split(" ")
print(len(max(S, key=lambda x: len(x))))

Solution (Python):
s = list(input())
a = ""
ans = 0
for c in s:
    if c in ("A", "C", "G", "T"):
        a += c
    else:
        ans = max(ans, len(a))
        a = ""
print(max(ans, len(a)))

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