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

for i in S:
    if i in ACGT:
        sum += 1
    else:
        listResult.append(sum)
        sum = 0
else:
    listResult.append(sum)
    
print(max(listResult))

Solution (Python):

a = str(input())

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

print("{}".format(max))

Solution (Python):
import re

s = input()
sr = re.split('[^ATGC]', s)
print(len(max(sr, key=len)))

Solution (Python):
import re

s = input()

s = re.split('[^ACGT]', s)

print(max([len(i) for i in s]))

Solution (Python):
s = input()
ans = 0
l = []
for i in range(len(s)):
    if s[i] in list('ACGT'):
        ans += 1
    else:
        l.append(ans)
        ans = 0
l.append(ans)
print(max(l))

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

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

Solution (Python):
s = list(input())
n = len(s)
ans = 0
li = []
for i in range(n):
    if s[i] in list('ACGT'):
        ans += 1
    else:
        li.append(ans)
        ans = 0
li.append(ans)
print(max(li))

Solution (Python):
input = input()

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

Solution (Python):
b = input()
bls = []

for x in range(0,len(b)):
    bls.append(b[x])

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


now = 0
maxx = 0

for x in bls:
    if ACGT(x):
        now += 1
    elif now >= maxx:
        maxx = now
        now = 0
    else:
        now = 0

if now >= maxx:
    maxx = now

print(maxx)

Solution (Python):
import sys
import math
import collections
import itertools
import array
import inspect


sys.setrecursionlimit(1000000)



def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))



def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in sys.stdin.readline().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v



def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk



def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def bisearch(L, target):
    low = 0
    high = len(L) - 1
    
    while low <= high:
        mid = (low + high) // 2
        guess = L[mid]
        if guess == target:
            return True
        elif guess < target:
            low = mid + 1
        elif guess > target:
            high = mid - 1
    if guess != target:
        return False



dp = None


def main():
    S = input()

    ans = 0

    c = 0

    for s in S:
        if s in "ATCG":
            c += 1
            ans = max(ans, c)
        else:
            c = 0

    print(ans)


main()

Solution (Python):
b = input()

a, a_cur =0,0

for c in b:
  if c in "ACGT":
    a_cur += 1
  else:
    a_cur = 0
  a = max(a,a_cur)
  
print(a)

Solution (Python):
def main():
    s = input()

    ans = 0
    for i in range(len(s)):
        cur = 0
        for j in range(i,len(s)):
            if s[j] in {"A", "C", "G", "T"}:
                cur += 1

            else:
                break

            ans = max(cur, ans)


    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
S = input()
judgeList = ['A', 'C', 'G', 'T']
maxLength = 0
currentLength = 0
for i, v in enumerate(S):
    if v in judgeList:
        currentLength += 1
    else:
        maxLength = max(currentLength, maxLength)
        currentLength = 0
maxLength = max(currentLength, maxLength)
print(maxLength)

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

Solution (Python):
S=input()
h=''.join(['1' if s in 'ATCG' else '0' for s in S])
print(max([c.count('1') for c in h.split('0')]))

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

print(max(map(len, t.split('0'))))

Solution (Python):
input = input().strip()
max = 0
max_tmp = 0
for i in range(len(input)):
  s = input[i]
  if s not in ['A', 'T', 'C', 'G']:
    max_tmp = 0
    continue
  max_tmp += 1
  if max_tmp > max:
    max = max_tmp
print(max)

Solution (Python):
s = input()

a, a_cur = 0, 0

for c in s:
    if c in "ACGT":
        a_cur += 1
    else:
        a_cur = 0
    a = max(a, a_cur)

print(a)

Solution (Python):
S = input()
l = len(S)
x = 0
for i in range(l):
    j = i + x + 1
    while(j <= l):
        k = i
        flag = True
        while(k < j):
            if S[k] not in ['A', 'C', 'G', 'T']:
                flag = False
                break
            else:
                k += 1
        if flag:
            x = j - i
        j += 1
print(x)

Solution (Python):
S = input()
i = ["A","G","C","T"]
list_S = [S]
ch = 0
an = 0
for j in S :
  if j in i :
    ch += 1
  else :
    an = max(an, ch)
    ch = 0
print(max(an,ch))

Solution (Python):
import re

S = input()

splitted = re.split("[^ATGC]", S)

max_length = 0
for inv in splitted:
    max_length = max(max_length, len(inv))

print(max_length)

Solution (Python):
S = input()

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

Solution (Python):
def main():
    S = input()
    dp = [0]*(len(S)+1)
    for i in range(len(S)):
        if(S[i]=='A' or S[i]=='C' or S[i]=='G' or S[i]=='T'):
            dp[i+1] = dp[i]+1
    print(max(dp))
main()

Solution (Python):
input = input()

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

count_list = []
count = 0
for letter in input:
    if letter in acgt:
        count += 1
        count_list.append(count)
    else:
        count = 0
        count_list.append(count)
print(max(count_list))

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

while i < len(s):
    if s[i] in k:
        s = s
    else:
        s_changed = s[:i] + 'z' + s[i + 1:]
        s = s_changed
    i += 1

s_split = s.split('z')
ans = len(max(s_split, key=len))
print(ans)

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

print(ans)

Solution (Python):
import re

S = input()

print(max(0, *map(len, re.findall("[AGCT]*", S))))

Solution (Python):
atcoder = input()
ACGT = list('ACGT')

s = ''
sub_list = []
for i, l in enumerate(list(atcoder)):
    if l in ACGT:
        s += l
        if i == len(atcoder)-1:
            sub_list.append(len(s))
    else:
        sub_list.append(len(s))
        s = ''
print(max(sub_list))

Solution (Python):


def main():
    s = input()
    ans = 0
    for i in range(len(s)+1):
        for j in range(i,len(s)+1):
            temp = s[i:j]
            
            
            if atgc_check(temp) and len(temp) > ans:
                ans = len(temp)
    print(ans)

def atgc_check(sub_s):
    for si in sub_s:
        if not si in ["A","T","G","C"]:
            return False
    return True

if __name__ == "__main__":
    main()

Solution (Python):
L = ["A","T","C","G"]
S = input()
S += "B"
count = 0
maxcount = 0
for i in S:
  if i in L:
    count += 1
  else:
    maxcount = max(count,maxcount)
    count = 0
print(maxcount)

Solution (Python):
import re
str = input()
c = 0
ls = re.findall(r'[ACGT]*', str)
for _ in range(len(ls)):
    if (c < len(ls[_])):
        c = len(ls[_])
print(c)

Solution (Python):
L = ["A","T","C","G"]
S = input()
S = S+"B"
count = 0
maxcount = 0
for i in S:
    if i in L:
        count += 1
    else:
        maxcount = max(count,maxcount)
        count = 0

print(maxcount)

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

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

print(max(count_list))

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

print(max(map(len, t.split('0'))))

Solution (Python):
s=input()
acgt=["A","C","G","T"]
s=[s[i] in acgt for i in range(len(s))]
max_len=0
flag=False
for n in range(len(s),0,-1):
  for i in range(len(s)-n+1):
    if all(s[i:i+n]):
      max_len=n
      flag=True
      break
  if flag:
    break
print(max_len)

Solution (Python):
def main():
	s = input()
	max_len = 0
	this_len = 0
	is_start = False
	for c in s:
		if is_acgt(c):
			this_len += 1
			is_start = True
			if max_len < this_len:
				max_len = this_len
		else:
			this_len = 0
			is_start = False
	print(max_len)


def is_acgt(c: str) -> bool:
	if c in ["A", "C", "G", "T"]:
		return True
	return False

if __name__ == '__main__':
    main()

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

for i in S:
    if i in acgt:
        count += 1
        if count > max_count:
            max_count = count
    else:
        count = 0

print(max_count)

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

for i in S:
    if i in acgt:
        count += 1
    else:
        if count > max_count:
            max_count = count
        count = 0

print(max(max_count, count))

Solution (Python):
S = input()
max = 0
ans = 0
if S.isupper() and 0 < len(S) < 11:
    for str in S:
        if str == 'A' or str == 'C' or str == 'G' or str == 'T':
            ans += 1
            if max < ans:
                max = ans
        else:
            if max < ans:
                max = ans
            ans = 0
print(max)

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

if __name__ == '__main__':
    main()

Solution (Python):
s=list(input())
a=len(s)
l=[0]*a
t=0
for i in range(a):
  if s[i]=="A" or s[i]=="T" or s[i]=="G" or s[i]=="C":
    t+=1
    l[i]=t
  else:
    t=0
print(max(l))

Solution (Python):
s = input()
ACGT = "ACGT"


def isACGT(c):
    if (c in ACGT):
        return True
    else:
        return False

count = 0
max = 0
for i in range(len(s)):
    if (isACGT(s[i])):
        count = count + 1
    else:
        max = count if max < count else max
        count = 0
max = count if max < count else max
print(max)

Solution (Python):

import copy
import numpy as np
import random


s = list(str(input()))

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

print(ans)

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

Solution (Python):
S = input()

maxC = 0
count = 0

for c in S:
    if c in "ACTG":
        count += 1
    else:
        if maxC < count:
            maxC = count
        count = 0

print(max(count,maxC))

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):
s = list(input())
ans = 0
count = 0
for i in range(len(s)):
  if s[i] == 'A' or s[i] == 'T' or s[i] == 'C' or s[i] == 'G':
    count += 1
    if ans < count:
      ans = count
  else:
    count = 0
print(ans)

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

Solution (Python):
def check(s,i):
   global count
   count+=1
   if i+1 < len(s):
       if s[i+1] == 'A' or s[i+1] == 'C' or s[i+1] =='G' or s[i+1] =='T':
           check(s,i+1) 

s=input()
count=0
list=[]
for i in range(len(s)):
    count=0
    if s[i] == 'A' or s[i] == 'C' or s[i] =='G' or s[i] =='T':
        check(s,i)
    list.append(count)

print(max(list))

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):
S = input()
L = ['A', 'T', 'C', 'G']
n, num = 0, 0
for s in S:
    if s in L:
        n += 1
    else:
        if n > num:
            num = n
        n = 0
if n > num:
    num = n
print(num)

Solution (Python):
S = raw_input()
length = 0
max_length = 0
for s in S:                                                                                                         
    if s == "A" or s == "C" or s == "G" or s == "T":
        length += 1
        if max_length < length:
            max_length = length
    else:
        length = 0
print max_length

Solution (Python):
s=input()

res=0
for i in range(len(s)+1):
    for j in range(i+1,len(s)+1):
        cnt=0
        for x in s[i:j]:
            if x not in ['A','G','C','T']:
                break
            cnt+=1
        if res<cnt:
            res=cnt

print(res)

Solution (Python):
def atcoder(string):
    acgt = set('ACGT')                                               
    on_count = False                                                 
    count = 0 
    max_count = 0                                                    
    
    for c in string:
        if c in acgt:
            if not on_count:
                on_count = True                                      
            count += 1                                               
        else:
            if on_count:
                on_count = False
                max_count = max(max_count, count)
                count = 0 

    if on_count:
        max_count = max(max_count, count)
                                  
    return max_count              
                                  
                                  
if __name__ == "__main__":
    string = input()
    print(atcoder(string))

Solution (Python):
argv = input()

n = 0
r = 0
for s in argv:
    if s == "A" or s == "T" or s == "G" or s == "C":
        n += 1
    else:
        n = 0
    r = max(r, n)
print(r)

Solution (Python):
S = input()
X = 'ATCG'
res = [0]
cnt = 0
for s in S:
    if s in X:
        cnt += 1
        res.append(cnt)
    else:
        cnt = 0
print(max(res))

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

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

x = list(input())

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

print(max(ans))

Solution (Python):
S = input()

ACGT = 'ACGT'
l = 0
max_l = 0
for i in S:
  if i in ACGT:
    l += 1
    max_l = max(max_l, l)
  else:
    l = 0
print(max_l)

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

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

lst = []
cnt = 0

for x in s:
  if x in tgt:
    cnt = cnt +1
  else:
    lst.append(cnt)
    cnt = 0
    
lst.append(cnt)

print(max(lst))

Solution (Python):


def main():
    b = input()

    maxcnt = 0
    scnt = 0
    for c in b:
        if(c=='A' or c=='C' or c=='G' or c=='T'):
            scnt += 1
        else:
            if(maxcnt<scnt):
                maxcnt=scnt
            scnt = 0

    print(max(scnt,maxcnt))

main()

Solution (Python):
input_str=input()
j=0
l1=[0]
for i in range(len(input_str)):
  k=input_str[i]
  if (k=="A"or k=="T"or k=="G"or k=="C"):
    j+=1
  else:
    l1.append(j)
    j=0
l1.append(j)
print(max(l1))

Solution (Python):
def main():
    *S, = input()
    count = 0
    maximum = 0
    for i in S:
        if i == "A" or i == "C" or i == "G" or i == "T":
            count += 1
        else:
            if maximum < count:
                maximum = count
            count = 0
    print(max(count, maximum))
main()

Solution (Python):
s = input()
n = len(s)
check = {"A", "C", "G", "T"}
ans = {0}
for i in range(n):
    tmp = s[i]
    if tmp not in check:
        continue
    ans.add(1)
    for j in range(i+1, n):
        if s[j] not in check:
            break
        tmp += s[j]
        ans.add(len(tmp))

print(max(ans))

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

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

Solution (Python):
def change(c):
  if c in atcg:
    return "1"
  else:
    return "0"
  
s = input()
atcg = "ATCG"
s = "".join([change(i) for i in s])
print(max([len(i) for i in s.split("0")]))

Solution (Python):
S = input()
def change(i):
  if i in "ATGC":
    return "1"
  else:
    return "0"
  
S = "".join([change(i) for i in S])
print(max([len(i) for i in S.split("0")]))

Solution (Python):
def solve(s):
    ans = 0
    cnt = 0
    for c in s:
        if c in ["A", "C", "G", "T"]:
            cnt += 1
        else:
            cnt = 0
        ans = max(ans, cnt)
    return ans

print(solve(input()))

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, len(s[i:j + 1]))

print(ans)

Solution (Python):
import re
S = re.split('B|D|E|F|[H-S]|[U-Z]',input())

len_S = [len(x) for x in S]
print(max(len_S))

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

result = re.sub('[^ACGT]', ',', s).split(',')

print(max([len(r)for r in result]))

Solution (Python):
import re

str = input()


pattern = r"[ATCG]+"

matched_list = re.findall(pattern, str)

maxlength = 0
for item in matched_list:
    tmplength = len(item)
    if maxlength < tmplength:
        maxlength = tmplength

print(maxlength)

Solution (Python):
s = input()
s_len = len(s)

counter_list = []
for j in range(s_len):
    counter = 0

    for i in range(j, s_len):
        if s[i] == 'A' or s[i]=='T' or s[i]=='G' or s[i]=='C':
            counter += 1
        else:
            break
    counter_list.append(counter)
    
print(max(counter_list))

Solution (Python):
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)

Solution (Python):
acgt = ['A','C','G','T']
max = 0
cur = 0
str = input() + 'Z'
 
for c in str:
  if(c in acgt):
    cur += 1
  else:
    if(max < cur):
      max = cur
    cur = 0
print(max)

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

Solution (Python):
import re;print(max([len(i)for i in re.findall('[ACGT]+',input())]+[0]))

Solution (Python):
s = input().strip()
cur = 0
mx = 0
for x in s:
    if x in "GCAT":
        cur += 1
        mx = max(mx, cur)
    else:
        cur = 0
print(mx)

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

for i in range(len(S)):
    if S[i] in answer:
        j = 0
        count = 0
        while S[i+j] in answer:
            count += 1
            if count > max_count:
                max_count = count
            j += 1
            if i + j >= len(S):
                break;
print(max_count)

Solution (Python):
S = input()

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

Solution (Python):


import sys

def parse_input(lines_as_string = None):


    lines = []
    if lines_as_string is None:
        lines.append(input())
    else:
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    tokens = lines[0].split(" ")
    s = tokens[0]

    return (s,)


def solve(s):

    m = 0
    for ss_length in range(len(s) + 1):
        for i in range(len(s)):
            if i+ss_length > len(s):
                break

            ss = s[i:i+ss_length]

            count = 0
            for c in ss:
                if c in "ACGT":
                    count = count + 1
            if count == ss_length and m < ss_length:
                m = ss_length
                break


    return m

def main():
    

    print("%s" % solve(*parse_input()))

if __name__ == '__main__':

    main()

Solution (Python):
s = input()
s += 'B'

ans = 0
cnt = 0
for c in s:
    if (c == 'A' or c == 'C'
            or c == 'G' or c == 'T'):
        cnt += 1
    else:
        if (ans < cnt):
            ans = cnt
        cnt = 0

print(ans)

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

count = 0
result = []

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 i == len(S) - 1:
      result.append(count)
  else:
    result.append(count)
    count = 0
    if i == len(S) - 1:
      result.append(count)

maxi = result[0]
    
for j in range(len(result)):
  if maxi < result[j]:
    maxi = result[j]

print(maxi)

Solution (Python):
s = input().strip()
cur = 0
mx = 0
for x in s:
    if x in ["G", "C", "A", "T"]:
        cur += 1
        mx = max(mx, cur)
    else:
        cur = 0
print(mx)

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

res = 0
for i in range(n):
    cnt = 0
    k = i
    while k != n and s[k] in p:
        cnt += 1
        k += 1
    res = max(res,cnt)
print(res)

Solution (Python):
S = input() + 'x'
acgt = ('A','C','G','T')
curran = 0
longest = 0

def check1(l):
    for i in acgt:
        if l == i:
            return True
    return False

for i in S:
    if check1(i):
        curran += 1
    elif not check1(i):
        if curran > longest:
            longest = curran
        curran = 0
        
print(longest)

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):
S = input()
N = len(S)
count = 0
max = 0
for i in range (N):
  if S[i] == "A" or S[i] == "T" or S[i] == "C" or S[i] == "G":
    count = count + 1
  else:
    if count > max:
      max = count
    count = 0
if count > max:
  max = count
  
print(max)

Solution (Python):

"""
B - ATCoder
https://atcoder.jp/contests/abc122/tasks/abc122_b

"""
import sys
import re

def solve(S):
    return max([len(f) for f in re.findall(r'[ACGT]+', S)], default=0)


def main(args):
    S = input()
    ans = solve(S)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Solution (Python):
s = list(input())
c,max = 0,0
for i in range(0,len(s)):
  if s[i] in "ATCG":
    c=1
    for j in range(i,len(s)):
      if s[j] in "ATCG":
        if j!=i:
          c+=1
      else:
        break
  if max < c:
    max=c      
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, len(S[i: j + 1]))

print(ans)

Solution (Python):
str = input()

def cnt(s):
    count = 0
    for st in s:
        if st is 'A' or st is 'C' or st is 'G' or st is 'T':
            count += 1
        else:
            return count
    return count

cs = 0
max = 0
for s in str:
    res = cnt(str[cs:len(str)])
    if max < res:
        max = res
    cs += 1
print(max)

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

for i in s:
    if i in arr:
        tmp += 1
    else:
        tmp = 0
    if ans < tmp:
        ans = tmp
print(ans)

Solution (Python):
b = input()
m, c = 0, 0
for i in b:
    if i in "ACGT":
        c += 1
        if c > m:
            m = c
    else:
        c = 0
print(m)

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

Solution (Python):
class Test:
    def __init__(self):
        pass

class CustomUtils:
    def __init__(self):
        pass
    def to_int(self, inputs, sp=' '):
        if sp == '':
            return [int(d) for d in list(inputs)]
        else:
            return [int(d) for d in inputs.split(sp)]
    def debug_print(self, inputs, debug=False):
        if debug:
            print(inputs)



def memorize(f):
    table = {}
    def func(*args):
        if not args in table:
            table[args] = f(*args)
        return table[args]
    return func
debug = False


u = CustomUtils()
iarray = list(input())

@memorize
def acgt(i):
    if i < 0:
        return 0
    elif iarray[i] in ['A', 'C', 'G', 'T']:
        return acgt(i -1) + 1
    else:
        return 0
result = max(acgt(i) for i in range(len(iarray)))
print("{}".format(result))

Solution (Python):

	
S = input()
T = ""

result = 0

while True:
	counter = 0

	for val in range(len(S)):
		if S[val] == "A":
			T = S[val:]	
			counter += 1
			break
		elif S[val] == "C":
			T = S[val:]	
			counter += 1
			break
		elif S[val] == "G":
			T = S[val:]	
			counter += 1
			break
		elif S[val] == "T":
			T = S[val:]	
			counter += 1
			break

	if val+1 != len(S):

		for val in range(1,len(T)):
			if T[val] == "A":
				counter += 1
			elif T[val] == "C":
				counter += 1
			elif T[val] == "G":
				counter += 1
			elif T[val] == "T":
				counter += 1
			else:
				S = T[val:]
				break


	if result < counter:
		result = counter

	if val+1 == len(S):
		break
	if val+1 == len(T):
		break

print(result)

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

Solution (Python):
acgt = ["A","C","G","T"]
b = list(input())
count = 0
cmax = 0
for i in range(len(b)):
    if b[i] in acgt:
        count+=1
        if( cmax < count):
            cmax = count
    else:
        count = 0
print(cmax)

Solution (Python):
S = input()

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

Solution (Python):
d = ["A","G","T","C"]
s = input()
r=[0]
n = 0
bf =0
for t in s:
    if t in d:
        n +=1
        bf = 1
        continue
    if bf == 1:
        r.append(n)
        n=0
    bf = 0
if bf == 1:
        r.append(n)
        
print(max(r))

Solution (Python):
import re
s = str(input())
answer = 0
for first in range(len(s)):
    for last in range(first,len(s)):
        if all('ACGT'.count(c) == 1 for c in s[first:last + 1]):
                answer = max(answer, last - first + 1)
print(answer)

Solution (Python):
words = list(input())
binary_list = []
for word in words:
  if word == "A" or word == "T" or word == "C" or word == "G":
      binary_list.append(1)
  else:
      binary_list.append(0)
max_counter = 0
for first in range(len(binary_list)):
    counter = 0
    multi = 1
    if binary_list[first] == 1:
        while(multi):
            multi *= binary_list[first]
            if multi == 0:
                break
            counter += 1
            if counter >= max_counter:
                max_counter = counter
            if first == len(binary_list) - 1:
                break
            else:
                first += 1
print(max_counter)

Solution (Python):
import re
S = input()
slist = re.findall(r'[ACGT]+', S)
if slist:
  print(max(map(len, slist)))
else:
  print(0)

Solution (Python):


S = input().strip()

res = 0
count = 0
for c in S:
    if c in 'ACGT':
        count += 1
    else:
        res = max(res, count)
        count = 0

print(max(res, count))