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 = list(input())
l = ["A", "C", "G", "T"]
l2 = []
cnt = 0
for i in range(len(s)):
    if s[i] in l:
        cnt += 1
    else:
        l2.append(cnt)
        cnt = 0
l2.append(cnt)
print(max(l2))

Solution (Python):


import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

s = input()
n = len(s)
ans = 0
lst = ['A','T','G','C']
for i in range(n):
    if s[i] not in lst:
        continue
    cnt = 0
    for j in range(i,n):
        if s[j] not in lst:
            break
        cnt += 1
    ans = max(ans,cnt)
print(ans)

Solution (Python):
import itertools
import math
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
INF = 1 << 60
sys.setrecursionlimit(10 ** 6)


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

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

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

Solution (Python):
import re
s = input()
m = re.findall(r'[A|T|C|G]+', s)
maxlen = 0
for tmp in m:
    maxlen = max(len(tmp), maxlen)
print(maxlen)

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

for i in range(len(s)):
    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
        count = 0
        j = i
        while s[j] == "A" or s[j] == "C" or s[j] == "G" or s[j] == "T":
            j = j + 1
            count = count + 1
            if j == len(s):
                break

        ans = max(ans, count)

print(ans)

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

Solution (Python):










"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
 
def main():
  s = input() + "X"
  TMP = ['A','C','G','T']
  Nya = 0
  flag = False
  i = 0
  first = 0
  last = 0
  while i != len(s):
    if s[i] in TMP:
      if not flag:
        
        flag = True
        first = i
    else:
      if flag:
        
        flag = False
        last = i
    Nya = max(Nya,abs(first-last))
    i += 1
  LIST = list(s)
  print(Nya)
if __name__ == '__main__':
  main()

Solution (Python):
b=input()

ans = 0
ans_list = [0]*len(b)
for i in range(len(b)):
  if (b[i] == 'A')or (b[i] =='C')or(b[i] =='G')or(b[i] =='T'):
    ans += 1
  else:
    ans = 0
  ans_list[i] = ans
print(max(ans_list))

Solution (Python):
S = input()
N = len(S)
L = ["A", "T", "C", "G"]
ans = 0

for i in range(N):
    for j in range(N-i):
        sub = S[j:j+i+1]
        for k in range(len(sub)):
            if sub[k] not in L:
                break
        else:
            ans = len(sub)

print(ans)

Solution (Python):






def resolve():
    S= input()

    x=[len(i) for i in "".join(([ i if i in "ACGT" else " " for i in S])).split()]

    if not x:
        print(0)
    else:
        print(max(x))


if __name__ == "__main__":
    resolve()

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

for i in range(len(S)):
    tmp = 0
    for j in range(i, len(S)):
        if S[j] in ACGT:
            tmp += 1
            Ans = max(Ans, tmp)
            continue
        else:
            break
        
print(Ans)

Solution (Python):
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque
from decimal import *


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


if __name__ == '__main__':
    s = input()
    b = ["A","C","G","T"]

    max =0
    count = 0
    for i in s:
        if i in b:
            count +=1
        else:
            count =0
        if max < count:
            max =count

    print(max)

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

S = input()

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

ans = 0
tmp = 0
for ch in S:
    if ch in ch_list:
        tmp += 1
        ans = max(ans, tmp)
    else:
        tmp = 0 

print(ans)

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

print(cnt)

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

cnt_list = []
cnt = 0
for i in s:
    if i in ACGT:
        cnt += 1
    else:
        cnt_list.append(cnt)
        cnt = 0
print(max(cnt_list))

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

print(ans)

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

Solution (Python):
S = input()
ans = 0
acgt = "AGCT"
for i in range(len(S)):
    count = 0
    if S[i] not in acgt:
        continue
    else:
        count += 1
    for j in range(i + 1, len(S)):
        if S[j] in acgt:
            count += 1
        else:
            break
    ans = max(ans, count)
print(ans)

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

ans = [0]*10
for i in range(len(s)):
  if s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T':
    ans[i] += 1
    
count = 0    
cnt = []
for i in range(10):
  if ans[i] == 0:
    cnt.append(0)
    count = 0
  else:
    count += 1
    cnt.append(count)
    
print(max(cnt))

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

def judge(s):
    if s == "A" or s == "C" or s =="G" or s =="T":
        return True
    else:
        return False

pt_l,pt_r,ans = 0,0,0
while pt_r < len(S):
    if judge(S[pt_r]):
        pt_r += 1
    else:
        ans = max(ans,pt_r - pt_l)
        pt_l = pt_r+1
        pt_r = pt_l
ans = max(ans,pt_r - pt_l)
print(ans)

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

Solution (Python):
s = input()
for i in range(len(s)+1):
    for j in range(len(s)-i+1):
        if [k for k in s[j:j+i]] == [k for k in s[j:j+i] if k=='A' or k=='G' or k=='C' or k=='T']:
            a=i
print(a)

Solution (Python):
S = input()
ans = 0
ACGT = ["A","C","G","T"]
for i in range(len(S)):
    for j in range(i,len(S)+1):
        clipped_list = list(S[i:j])
        clipped = set(clipped_list)
        for acgt in ACGT:
            try:
                clipped.remove(acgt)
            except:
                pass
        if clipped == set():
            ans = max(ans,len(clipped_list))

print(ans)

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

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

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

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

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

Solution (Python):
s = input()
ACGT = "ACGT"
cnt = 0
ans = 0

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

print(max(ans, cnt))

Solution (Python):
s = input()
sl = len(s)
l = [0]*sl
c = 0
ans = 0

for i in range(sl):
    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
        l[i] = 1

for i in range(sl):
    if l[i] == 1:
        c += 1
    else:
        ans = max(ans, c)
        c = 0

ans = max(ans, c)
print(ans)

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

Solution (Python):
s = input()
count = 0
ans = 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):

"""
Created on Tue Mar 31 09:40:38 2020

@author: black
"""


S = list(input())

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

Solution (Python):
def solve():
    s = input()
    n = len(s)
    ans = 0
    for i in range(n):
        for j in range(i+1,n+1):
            tmp = s[i:j]
            tmp = tmp.replace('A','').replace('T','').replace('G','').replace('C','')
            if len(tmp)==0:
                ans = max(ans,j-i)
    print(ans)
if __name__ == "__main__":
    solve()

Solution (Python):

"""
Created on Tue Mar 31 02:20:28 2020

@author: liang
"""

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

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

Solution (Python):

S = list(input())

lenS = len(S)
ans = 0

for i in range(1, lenS+1):
    for j in range(lenS-i+1):
        tmp = S[j:j+i]
        if set(tmp).issubset(['A', 'C', 'G', 'T']):
            
            ans = max(len(tmp), ans)

print(ans)

Solution (Python):

S = list(input())

lenS = len(S)
ans = 0

for i in range(1, lenS+1):
    for j in range(lenS-i+1):
        tmp = S[j:j+i]
        if set(tmp).issubset(['A', 'C', 'G', 'T']):
            
            ans = max(len(tmp), ans)

print(ans)

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

Solution (Python):
s = input()
s = s.translate(str.maketrans('ACGT', '1111'))
ans = 0
tmp = 0
for i in s:
    if i == '1':
        tmp += 1
    else:
        tmp = 0
    ans = max(ans, tmp)
print(ans)

Solution (Python):
s = input()

ans = 0
n = 0
acgt = ('A', 'C', 'G', 'T')
for si in s:
    if si in acgt:
        n += 1
    else:
        if n > ans:
            ans = n
        n = 0
if n > ans:
    ans = n
print(ans)

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

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

Solution (Python):
S = input()

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

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

print(max(map(len,re.split("[^ACGT]",s))))

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

def resolve():
    S = input()
    acgt = ('A', 'C', 'G', 'T')
    ans = 0

    for l in range(len(S)):
        for r in range(l+1, len(S)+1):
            
            if S[r-1] not in acgt:
                ans = max(r-1-l, ans)
                break
            if r==len(S):
                ans = max(len(S)-l, ans)
 
    print(ans)

if __name__ == '__main__':
    resolve()

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

def resolve():
    S = input()
    acgt = ('A', 'C', 'G', 'T')
    ans = 0
    
    
    
    
    
    
    

    for l in range(len(S)):
        for r in range(l+1, len(S)+1):
            
            if re.fullmatch(r'[ACGT]*', S[l:r]):
                ans = max(r-l, ans)
            
            
            
 
    print(ans)

if __name__ == '__main__':
    resolve()

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

def resolve():
    S = input()
    acgt = ('A', 'C', 'G', 'T')
    ans = 0
    l = 0
    while (l < len(S)) and (len(S)-l > ans):
        r = l+1
        while (r < len(S)+1) and (S[r-1] in acgt):
            r += 1
        ans = max(r-1-l, ans)
        l += 1

    print(ans)

if __name__ == '__main__':
    resolve()

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

ret=0

for i in range(n):
    j=i
    while j<n and s[j] in chk:
        j+=1

    ret=max(ret,j-i)

print(ret)

Solution (Python):

import math
import itertools
import statistics







s = input()
max_ = 0
count = 0

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

    if max_ <= count:
        max_ = count
    
    

print(max_)

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

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

Solution (Python):
S = list(map(str,input()))
count = 0
ans = 0

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

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

Solution (Python):

S=input()
ATGC=["A","T","G","C"]
ans=0
tmp=0
for i in range(len(S)):
  if S[i:i+1] in ATGC:
    tmp +=1
  else:
    tmp=0
  if ans<tmp:
    ans=tmp

print(ans)

Solution (Python):
s_list = list(input())
n = len(s_list)
dic = {"A", "C", "G", "T"}
ans = 0
tmp_ans = 0
for i in range(n):
    for j in range(i, n):
        if s_list[j] in dic:
            tmp_ans += 1
        else:
            ans = max(ans, tmp_ans)
            tmp_ans = 0
        if j == n - 1:
            ans = max(ans, tmp_ans)
            tmp_ans = 0
ans = max(ans, tmp_ans)
print(ans)

Solution (Python):



S = list(input())


max_count = 0
atgc_list = ['A', 'T', 'G', 'C']


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

print(max_count)

Solution (Python):
import math
import copy
from copy import deepcopy
import sys
import fractions

from functools import reduce

import decimal
import heapq
import collections
import itertools
from operator import mul

sys.setrecursionlimit(100001)







def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList




s = input()
s = s+" "

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

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

print(ans)

Solution (Python):
def main():
  
  s = input()
  
  
  
  
  
  
  ans = 0
  count = 0
  lis = []
  
  for i in s:
    if i in "ACGT":
      count += 1
      ans = max(ans,count)
    else:
      count = 0
  print(ans)

if __name__ == '__main__':
  main()

Solution (Python):
ATGC=['A', 'T', 'G', 'C']
S=input()
N=len(S)
maxlen=0
count=0

for i in range(N):
    if S[i] in ATGC:
        count+=1
    else:
        count=0
    if count>maxlen:
        maxlen=count
print(maxlen)

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

Solution (Python):
s = input()

str_max = ""
int_max = 0
str_temp = ""
int_temp = 0

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

    if int_max < int_temp:
        int_max = int_temp
        str_max = str_temp

print(int_max)

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

Solution (Python):
import re

S=input()
ans = sorted((re.findall("[AGCT]*", S)), reverse=True, key=len)
print(len(ans[0]))

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

Solution (Python):
S = input()
ans = 0
for s in range(len(S)):
    for e in range(s + 1, len(S) + 1):
        ss = S[s:e]
        for c in ss:
            if not c in "ACGT":
                break
        else:
            ans = max(ans, len(ss))
print(ans)

Solution (Python):
s = str(input())
n = len(s)
ACGT = {"A", "C", "G", "T"}

res = []
for i in range(n):
    cnt = 0
    for j in range(i, n):
        if s[j] in ACGT:
            cnt += 1
        else:
            break
    res.append(cnt)

print(max(res))

Solution (Python):
s = input()

def agct(s):
    for t in s:
        if not t in 'ACGT':
            return False
    else:
        return True
count = 0
for i in range(len(s)):
    for j in range(i+1, len(s)+1):
        if agct(s[i:j]):
            count = max(count, len(s[i:j]))
print(count)

Solution (Python):
check = ["A", "C", "G", "T"]

s = input()
ans = 0
tmp = 0

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

Solution (Python):
def RLE(S):
    res = []
    N = len(S)
    i = 0
    while i < N:
        cnt = 1
        while i < N - 1 and S[i] == S[i + 1]:
            cnt += 1
            i += 1
        res.append((S[i], cnt))
        i += 1
    return res


if __name__ == "__main__":
    S = list(input())
    term = "ATCG"
    X = ""
    for s in S:
        if s in term:
            X += "1"
        else:
            X += "0"
    rle = RLE(X)
    ans = 0
    for k, v in rle:
        if k == "1":
            ans = max(ans, v)
    print(ans)

Solution (Python):



def is_acgt(c):
    acgt = ['A', 'C', 'G', 'T']

    return c in acgt


if __name__ == "__main__":
    S = input()

    result = 0
    tmp_result = 0
    for c in S:
        if (is_acgt(c)):
            tmp_result += 1
            result = max(result, tmp_result)
        else:
            tmp_result = 0

    print(result)

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

max_len = 0
now = 0
for char in s:
    if char not in atcg:
        max_len = max(now,max_len)
        now = 0
        continue
    now += 1
print(max(now,max_len))

Solution (Python):


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

Solution (Python):
s = input()

num = 0
ans = 0

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

print(ans)

Solution (Python):
S = list(input())
s = ['A','C','G','T']
cnt = 0
max = 0
for i in range(len(S)):
  for j in range(i,len(S)):
    if s.count(S[j]) != 0:
      cnt += 1
    else:
      break
  if max < cnt:
    max = cnt
  cnt = 0
print(max)

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

Solution (Python):



S = input()
SPECIAL = ["A", "C", "G", "T"]

ans = 0
n = 0
for s in S:
    if s in SPECIAL:
        n += 1
    else:
        if ans < n:
            ans = n
        n = 0
if ans < n:
    ans = n

print(ans)

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

i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()

S = i_s()

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

ans = max(ans, cnt)

print(ans)

Solution (Python):
s = input()

len = 0
result = 0

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

Solution (Python):





s=list(input())
n=len(s)
l=["A","C","G","T"]
ansl=[0]
for i in range(n):
    for j in range(n):
        if i>j:
            continue
        partial=s[i:j+1]
        flag=True
        for p in partial:
            if not p in l:
                flag=False
                break
        if flag:
            ansl.append(len(partial))
print(max(ansl))

Solution (Python):
s=input()
count=0
maxcount=0

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

print(maxcount)

Solution (Python):
S = input()

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

Solution (Python):
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


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

    S = iss()
    ret = 0
    cnt = 0
    for s in S:
        if 'A' in s: cnt += 1
        elif 'C' in s: cnt += 1
        elif 'G' in s: cnt += 1
        elif 'T' in s: cnt += 1
        else: cnt = 0
        ret = max(ret, cnt)

    print(ret)


if __name__ == '__main__':
    main()

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

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

print(ans)

Solution (Python):
import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *
from math import *
from fractions import *

sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()

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

Solution (Python):
S = list(map(str, input()))
cnt = 0
CNT = []
for i in range(len(S)):
    if S[i]=='A' or S[i]=='C' or S[i]=='G' or S[i]=='T':
        cnt += 1
        if i==len(S)-1:
            CNT.append(cnt)
    if S[i]!='A' and S[i]!='C' and S[i]!='G' and S[i]!='T':
        CNT.append(cnt)
        cnt = 0

print(max(CNT))

Solution (Python):
print(len(max(''.join(str(+(c in'ATGC'))for c in input()).split('0'))))

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

Solution (Python):

S = input()
N = len(S)
m = 0
for i in range(N+1):
    for j in range(i+1):
        s = S[j:i]
        l = list(s)
        l = [k for k in l if k not in ["A", "G", "C", "T"]]
        if len(l) == 0:
            m = max(m, i-j)
print(m)

Solution (Python):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    atcg=set(['A','T','C','G'])
    s=STR()
    ct=0
    for i in range(len(s)):
        if s[i] in atcg:
            temp=1
            for k in range(1,len(s)-i):
                if s[i+k] in atcg:
                    temp+=1
                    
                else:
                    break
            ct=max(temp,ct)
    print(ct)
if __name__ == '__main__':
    do()

Solution (Python):
s=input()
cnt=0
temp=0
for i in s:
    if i in 'ATGC':
        temp+=1
        continue
    if cnt<temp:
        cnt=temp
        temp=0
if cnt<temp:cnt=temp
print(cnt)

Solution (Python):
import sys


def get_ngram(n, s):
    return [''.join(s[i:i+n]) for i in range(len(s)-n+1)]


def main():
    S = input()
    chars = {'A', 'C', 'G', 'T'}

    for i in range(len(S), -1, -1):
        for c in get_ngram(i, S):
            if set(c) <= chars:
                print(i)
                sys.exit()


if __name__ == "__main__":
    main()

Solution (Python):
from itertools import combinations
import sys


def get_ngram(n, s):
    return [''.join(s[i:i+n]) for i in range(len(s)-n+1)]


def main():
    S = input()
    chars = {'A', 'C', 'G', 'T'}

    for i in range(len(S), -1, -1):
        for c in get_ngram(i, S):
            if set(c) <= chars:
                print(i)
                sys.exit()


if __name__ == "__main__":
    main()

Solution (Python):
s = input()
n = len(s)
x = [0] * n
fl = 1
if s[0] == 'A' or s[0] == 'T' or s[0] == 'C' or s[0] == 'G':
    x[0] = 1
        
for i in range(1,n):
    if s[i] == 'A' or s[i] == 'T' or s[i] == 'C' or s[i] == 'G':
        x[i] = x[i-1] + 1
    else:
        x[i] = 0

print(max(x))

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

Solution (Python):
def inpl():
    return list(map(int, input().split()))


S = input()

ans = 0
for i in range(len(S)):
    for j in range(i, len(S)):
        if S[j] not in "AGTC":
            ans = max(j - i, ans)
            break
    else:
        ans = max(len(S) - i, ans)
print(ans)

Solution (Python):
S = input()

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

print(cmax)

Solution (Python):


S=list(input())

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

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

def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))





def main():
	ACGT="ACGT"
	s=input()
	ans=0
	cnt=0
	for i in s:
		if i in ACGT:
			cnt+=1
		else:
			cnt=0
		ans=max(ans,cnt)
	print(ans)














if __name__ == "__main__":
	main()

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

Solution (Python):
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    S = readline().strip()

    ans = 0
    acgt = ["A", "C", "G", "T"]
    for i in range(len(S)):
        for j in range(i, len(S)):
            flag = True
            for k in S[i:j+1]:
                if k in acgt:
                    continue
                else:
                    flag = False
            if flag:
                ans = max(ans, j - i + 1)

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    S = readline().strip()

    ans = 0
    acgt = ["A", "C", "G", "T"]
    for i in range(len(S)):
        if S[i] in acgt:
            m = i
            tmp = 0
            while m < len(S) and S[m] in acgt:
                tmp += 1
                m += 1
            ans = max(ans, tmp)

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
S = input()

max_len = 0
for i in range(len(S)):
    for j in range(i, len(S)+1):
        tmp = S[i:j]
        for t in tmp:
            if t != 'A' and t != 'C' and t != 'G' and t != 'T':
                break
        else:
            if len(tmp) >= max_len:
                max_len = len(tmp)

print(max_len)

Solution (Python):
s=input()
cnt=0
tmp=0
for i in s:
    if i=="A" or i=="T" or i=="C" or i=="G":
        tmp+=1
    if tmp>0 and (i!="A" and i!="T" and i!="C" and i!="G"):
        cnt=max(cnt,tmp)
        tmp=0
cnt=max(cnt,tmp)
print(cnt)

Solution (Python):
S = input()

res = 0
cur = 0
N = len(S)
ACGT = ["A", "C", "G", "T"]
for i in range(N):
  if S[i] in ACGT:
    cur += 1
  else:
    cur = 0
  if cur > res:
    res = cur

print(res)

Solution (Python):
N = list(input())
m = 0
cnt = 0
for x in N:
    
    if x == 'A' or x == 'C' or x == 'G' or x == 'T':
        cnt += 1
    else:
        m = max(cnt, m)
        cnt = 0

m = max(cnt, m)

print(m)

Solution (Python):


MOD = 10**9
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

S = input()

ans = 0
for i in range(len(S)):
    for j in range(i, len(S)):
        s = S[i:j+1]
        a = s.count('A')
        g = s.count('G')
        c = s.count('C')
        t = s.count('T')
        if a+g+c+t == len(s) and len(s) > ans:
            ans = len(s)

print(ans)