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):
def ATCoder(s,can):
    n = len(s)
    count = 0
    
    for i in range(n):
        if s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T':
            count += 1
        else:
            if count > can:
                can = count
                count = 0
            can = ATCoder(s[i+1:],can)
            break
    else:
        if count > can:
            can = count
            count = 0

    return can
if __name__ == "__main__":
    s = input()
    print(ATCoder(s,0))

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

for i in range(len(S)):
    for j in range(i, len(S)):
        if S[j] in valid:
            count += 1
        else:
            break
    if count > max_len:
        max_len = count
    count = 0

print(max_len)

Solution (Python):

s = input()
max_length=0
length=0
for c in s:
    if c in 'AGCT':
        length+=1
    else:
        max_length=max(max_length, length)
        length=0
print(max(max_length, length))

Solution (Python):
S = input()
l = len(S)
A = {'A', 'C', 'G', 'T'}
ans = 0
for i in range(l):
    for j in range(l):
        if i + j > l:
            continue
        flag = True
        for s in S[i:l-j]:
            if s not in A:
                flag = False
                break
        if flag:
            ans = max(ans, len(S[i:l-j]))
print(ans)

Solution (Python):
import math
from collections import deque
from collections import defaultdict

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): 
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): 
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} 
def bitArr(n):
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): 
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq

s = readChar()

ans = -1

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

print(max(ans,0))

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

Solution (Python):
s = input()+"_"
cnt = 0
ans = 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:
        ans = max(ans, cnt)
        cnt = 0

print(ans)

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

ans=0
t_ans=0
for i in s:
  if i in 'ATGC':
    t_ans+=1
  else:
    ans=max(t_ans,ans)
    t_ans=0
print(ans)

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

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

Solution (Python):
s = input()

ans=0
for i in range(len(s)):
    ch=0
    for j in range(i,len(s)):
        if s[j] in 'ACGT':
            ch+=1
        else:
            ans=max(ans,ch)
            ch=0
    ans=max(ans,ch)
print(ans)

Solution (Python):
S = input()

acgt = {'A', 'C', 'G', 'T'}

for i in range(len(S)):
    window = len(S) - i
    for j in range(len(S) - window + 1):
        if set(S[j:j + window]).issubset(acgt):
            print(len(S[j:j + window]))
            break
    else:
        continue
    break
else:
    print(0)

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

count=0
v=0
for ch in S:
  if ch in DNA:
    count+=1
  else:
    if v < count:
      v=count
      count=0
    else:
      count=0
if v < count:
  v=count

print(v)

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

s=input()
ans=0
a=[]
for i in range(len(s)):
    if s[i] in l:
        ans+=1
        if i==len(s)-1:
            a.append(ans)
    elif s[i] not in l and i==len(s)-1:
        a.append(ans)
        ans=0
    else:
        a.append(ans)
        ans=0
print(max(a))

Solution (Python):

"""
Created on Sun May 17 20:16:43 2020

@author: Kanaru Sato
"""

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

Solution (Python):
import re

S = input()
r, ans, tmp = 0, 0, ''
N = len(S)
for l in range(N):
    while r < N and re.match(r'[ACGT]', S[r]):
        tmp += S[r]
        r += 1
    ans = max(ans, r - l)
    if l == r:
        r += 1
    else:
        tmp = tmp[l:]
print(ans)

Solution (Python):
s = input()
ans1 = 0
ans2 = 0

for a in s:
  if a == "A" or a == "T" or a == "C" or a == "G":
    ans2 += 1
  else:
    if ans1 < ans2:
      ans1 = ans2
      ans2 = 0
    else:
      ans2 = 0
print(max(ans1, ans2))

Solution (Python):
s=list(input())
maximum=0
temp=0
k=0
for i in range(len(s)):
    sets=set(s[i])
    if sets.issubset(set("ATGC")):
        k=k+1
        if k>=maximum:
            maximum=k
    else:
        k=0
print(maximum)

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

ans = 0
cnt = 0
for ss in s:
    if ss in t:
        cnt += 1
    else:
        ans = max(cnt, ans)
        cnt = 0
ans = max(cnt, ans)
print(ans)

Solution (Python):
import re
s=input()
ans=re.findall(r"((A|T|G|C)+)",s)

if ans==[]:
    print(0)
else:
    
    max=0
    for i in range(len(ans)):
        temp=ans[i][0]
        if len(temp) >= max:
            max=len(temp)
    print(max)

Solution (Python):
import re
s =input()
ans = re.finditer(r'(A|T|G|C)+',s)
max=0
for a in ans:
    temp=len(a.group())
    if temp>=max:
        max=temp
print(max)

Solution (Python):
s=input()
import re
ans=re.findall("[ATGC]+",s)
if ans==[]:
    print(0)
else:
    print(len(max(ans,key=len)))

Solution (Python):
s=input()
import re
ans=re.findall("[A,T,G,C]+",s)
if ans==[]:
    print(0)
else:
    print(len(max(ans,key=len)))

Solution (Python):
S = input()
maxlen=count=0
isT = True
for i in range(len(S)):
  if S[i] == "T":
    isT = True
  if S[i] == "T" or S[i] == "G" or S[i] == "C" or S[i] == "A":
    count += 1
  else:
    if isT and maxlen < count:
      maxlen = count
    count = 0
    isT = False
    
if isT and maxlen < count:
  maxlen = count

print(maxlen)

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

Solution (Python):
S = input() + "0"
length = 0
count = 0

for char in S:
    if char in "AGCT":
        count += 1
    else:
        length = max(length, count)
        count = 0

print(length)

Solution (Python):
import math
import copy
from queue import Queue
import heapq
import numpy as np

MOD = 5000000007









s = input()









n = len(s)

temp = 0
max = 0

for i in range(n):
    if(s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T"):
        temp += 1
    else:
        temp = 0
    if (max < temp):
        max = temp


print(max)

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

Solution (Python):
s=input()
clist=['A','C','G','T']
count=0
a=[]
for i in s:
  if i in clist:
    count+=1
  else:
    a.append(count)
    count=0
a.append(count)
print(max(a))

Solution (Python):
S=input()
length = len(S)
res = 0
for i in range(length):
  for j in range(i,length):
    if all(s in 'ATGC' for s in S[i:j+1]):
      res = max(res,j+1-i )
print(res)

Solution (Python):
import sys
s = sys.stdin.readline()
ans = 0
for i in range(len(s)):
    
    if s[i] not in {'A', 'C', 'G', 'T'}: continue
    length = 1
    for j in range(i + 1, len(s)):
        if s[j] in {'A', 'C', 'G', 'T'}:
            
            length += 1
        else: break
    ans = max(ans, length)
    
print(ans)

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

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

Solution (Python):
import itertools
import math
import fractions
import functools
import copy
s = input()

maximum = 0 
count = 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
        maximum = max(maximum,count)
    else:
        count = 0

print(maximum)

Solution (Python):
s = input()
l = len(s)
a = 0
ls = ["A","T","C","G"]
for i in range(l):
    for j in range(i + 1,l + 1):
        t = s[i:j]
        l2 = len(t)
        if a < l2:
            b = 0
            for k in range(l2):
                if t[k] not in ls:
                    b = 1
            if b == 0:
                a = l2

print(a)

Solution (Python):


import sys
import itertools

def main():
    S = list(str(sys.stdin.readline()))
    
    
    
    S_len = len(S)
    dp = [0]*(S_len+1)
    target = ["A", "C", "G", "T"]
    
    for i in range(1, S_len+1):
        if S[i-1] in target:
            dp[i] = max(1, dp[i-1]+1)
            
    print(max(dp))
                
    
if __name__ == "__main__":
    main()

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

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

Solution (Python):
a=input()
b=0
c=('A','C','G','T')
d=0
for i in range(len(a)):
	if a[i] in c:
		b+=1
		if b>d:
			d=b
	else:
		b=0
print(d)

Solution (Python):
S = input()
N = len(S)
a,b = 0,0
l = [0]

for i in range(N):
  if S[i] == 'A' or S[i] == 'C' or S[i] == 'G' or S[i] == 'T':
    a += 1
    b = 1
  else:
    if b:
      l.append(a)
      b = 0
      a = 0
else:
  if a:
    l.append(a)
  print(max(l))

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

length = 0
for i in range(N):
  for j in range(i,N):
    if all([(c in 'ACGT') for c in S[i:j+1]]):
      length = max(length, len(S[i:j+1]))

print(length)

Solution (Python):
s = input()
acgt = 'ACGT'

acgt_flag = False
length = 0
l = 0

for i in range(len(s)):
  if s[i] in acgt:
    if acgt_flag:
      l+=1
    else:
      l=1
      acgt_flag = True
  else:
    if acgt_flag:
      length = max(length, l)
      acgt_flag = False

length = max(length, l)
print(length)

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

acgt = set(["A","C","G","T"])
kekka = [0 for _ in range(lens)]

for i in range(lens):
    if s[i] in acgt:
        kekka[i] = 1

maxsum = 0

for i in range(lens):
    if kekka[i] == 1:
        sum = 0
        for j in range(i, lens):
            if kekka[j] == 1:
                sum += 1
            else:
                break
        if sum >= maxsum:
            maxsum = sum

print(maxsum)

Solution (Python):
import sys
import os
import math
import bisect
import collections
import itertools
import heapq
import re

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


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

    S = iss()
    print(max(map(len,re.findall('[ACGT]*', S))))


if __name__ == '__main__':
    main()

Solution (Python):
s = input()

ans = 0
flag = 0

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

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

Solution (Python):
S = input()
count = 0
max_s = 0

for s in S:
  if s in 'ACGT':
    count +=1
    max_s = max(count,max_s)
  else:
    count = 0
    
print(max_s)

Solution (Python):
def ATGC(i):
    if i == 'A' or i == 'T' or i == 'G' or i == 'C':
        return True

s = input()
a = 0
streak = 0
for i in s:
    if ATGC(i):
        streak += 1
    else :
        if a < streak :
            a = streak
            streak = 0
if streak > a:
    a = streak 
print(a)

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

Solution (Python):


import sys






















def main():
    mod = 1000000007                
    inf = float('inf')              
    
    sys.setrecursionlimit(10**6)    
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    s = input()
    n = len(s)
    b = [char in ['A', 'T', 'G', 'C'] for char in s]
    ans = 0
    current_streak = 0
    for i in range(n):
        if b[i]:
            current_streak += 1
        else:
            current_streak = 0
        ans = max(ans, current_streak)
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
s = input()
ans = [0]
for i in range(len(s)):
    for j in range(len(s)):
        l = s[i:j+1]
        if  all(x=='A'or x=='C' or x=='G' or x=='T' for x in l):
            ans.append(len(l))
print(max(ans))

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
import numpy as np
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = input()

tmp = []
tmp.append(-1)
for i, x in enumerate(S):
	if x != "A" and x != "T" and x != "G" and x != "C":
		tmp.append(i)
tmp.append(len(S))


tmp2 = [tmp[i+1] - tmp[i] for i in range(len(tmp)-1)]
print(max(tmp2)-1)

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

Solution (Python):
import re

S = input()

match = re.findall(r'[ACGT]+', S)
result = ""
for i in match:
    if len(result) <= len(i):
        result = i
print(len(result))

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
import numpy as np
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

ans = 0

for l in range(len(S)):
	r = l
	while r < len(S) and S[r] in atc:
		r += 1

	ans = max(ans, r-l)

print(ans)

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

Solution (Python):
s = input()

MAX = 0
m = 0
for i in s:
  if i == "A" or i == "G" or i == "C" or i == "T":
    m += 1
    MAX = max(MAX,m)
  else:
    m = 0
print(MAX)

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

ACGT = ['A', 'C', 'G', 'T']
ans = 0
for i in range(N):
    for j in range(i, N):
        flag = True
        for s in S[i:j + 1]:
            if s not in ACGT:
                flag = False
                break
        if flag and (j - i + 1) > ans:
            ans = j - i + 1
    
print(ans)

Solution (Python):
s = input()

tmp = 0
ans = 0
chars = ['A', 'C', 'G', 'T']

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

print(ans)

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

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

answer = 0
count = 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:
    count = 0
  answer = max(answer, count)
print(answer)

Solution (Python):
S=input()
S+="b"

ans=0
now=0
l=[i for i in "ACGT"]

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

print(ans)

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

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()
S = list(S)
str_list =  {"A","C","G","T"}
str_max = 0


for start in range(len(S)):
    for end in range(start+1, len(S)+1):
        S_list = S[start:end]

        if str_list | set(S_list) == str_list:
            str_max = max(str_max, len((S_list)))
           
        
           

print(str_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):
S=str(input())
ans=0
temp=0
for i in range(len(S)):
    if S[i]=='A' or S[i]=='C' or S[i]=='G' or S[i]=='T':
        temp+=1
        if i==len(S)-1:
            ans=max(ans,temp)
    else:
        ans=max(ans,temp)
        temp=0

print(ans)

Solution (Python):
S = list(input())
A = []
j = 0
ans = 0
while j < len(S):
  i = S[j]
  if i == "A" or i == "C" or i == "G" or i == "T":
    ans += 1
    j += 1
  else:
    A.append(ans)
    ans = 0
    j += 1
if ans > 0:
    A.append(ans)
print(max(A))

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

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

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

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

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
import sys
import re
def input(): return sys.stdin.readline().rstrip()
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = float('inf')


s = S()
ACGT = {'A', 'C', 'G', 'T'}
T = [x for x in re.split(r'[^ACGT]', s) if x != '']
ans = 0
for t in T:
    ans = max(ans, len(t))
print(ans)

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

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

print(ans)

Solution (Python):
S = input()
man = 0
cnt = 0
l = ['A', 'C', 'G', 'T']
for s in S:
    res = False
    for i in l:
        if s == i:
            cnt += 1
            res = True
    if res == False:
        cnt = 0
    if man < cnt:
        man = cnt
print(man)

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

Solution (Python):
s = input()

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

Solution (Python):

import sys

import fractions
import copy
import bisect
import math
import numpy as np
import itertools
from itertools import combinations_with_replacement


from operator import itemgetter
from sys import stdin

from operator import mul
from functools import reduce
from collections import Counter





j=0
k=0
n=3
r=1
a=[0]






"1行1つの整数を入力を取得し、整数と取得する"




"12 21 332 とか入力する時に使う"
"1行に複数の整数の入力を取得し、整数として扱う"

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

for i in number_list:
    print(number_list[i-1])

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'''
x=[]
y=[]
for i in range(N):
    x1, y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
print(x)
print(y)
"複数行に2数値を入力する形式 x座標とy座標を入力するイメージ"
'''

'''
mixlist=[]
for i in range(N):
    a,b=input().split()
    mixlist.append((int(a),b))
print(mixlist)
"複数行にintとstrを複合して入力するやつ，今回はリスト一つで処理している"
'''

'''



"正方行列にstr型の値を入力"
'''




'''
入力
1 2
4 5
7 8
出力結果
[[1, 2], [4, 5], [7, 8]]
'''
"列数に関して自由度の高いint型の値を入力するタイプの行列"


'''
table = [[int(i) for i in input().split()] for m in range(m)]

print(type(N))
print(N)
print(type(M))
print(M)

print(type(table))
print(table)
'''











'''
入力
1234
出力
1
[[1, 2, 3, 4]]
'''




'''
word_list= input().split(" ")
print(word_list[0])
"連続文字列の入力"
"qw er ty とかの入力に使う"
"入力すると空白で区切ったところでlistの番号が与えられる"
'''



'''
A, B, C=stdin.readline().rstrip().split()
print(A)
"リストではなく独立したstr型を入れるなら以下のやり方でOK"
'''




"aという変数に入っているものを大文字にして出力"

















'''
コンビネーションの組み合わせの中身を出力する形式
for i in itertools.combinations(brray, 2)
combinationsをpermutationsにすれば順列になる
今回なら(abc133B)
入力
1 2
5 5
-2 8
出力
[[1, 2], [5, 5], [-2, 8]]
もちろん一次元リストでも使えるし
何よりiもリストのように使えるので便利
'''


'''
def cmb(n,r):
    
    r= min(n-r,r)
    
    if r == 0: return 1
    over = reduce(mul, range(n, n-r, -1))
    
    
    

    under = reduce(mul, range(1, r+1))
    
    
    
    

    return over // under
    
    
    
    
a = cmb(n, r)

'''

'''
import itertools
from itertools import combinations_with_replacement

combinationについて
以下の違いを意識しよう
combinations() p, r 長さrのタプル列、ソートされた順で重複なし

combinations_with_replacement() p, r 長さrのタプル列、ソートされた順で重複あり


使用例 　　　　　　　　　　　                  出力　　
combinations('ABCD', 2)　　　　　　　　　　　　AB AC AD BC BD CD

combinations_with_replacement('ABCD', 2)　　 AA AB AC AD BB BC BD CC CD DD
'''



'''




for i in a.most_common(n):print(i)





 


'''









'''
bisect.bisect_left(a, x, lo=0, h=len(a))
引数
a: ソート済みリスト
x: 挿入したい値
lo: 探索範囲の下限
hi: 探索範囲の上限
(lo, hiはスライスと同様の指定方法)
bisect_leftはソートされたリストaに対して順序を保ったままxを挿入できる箇所を探索します。leftが示す通り、aにすでにxが存在している場合は、挿入箇所は既存のxよりも左側になります。また、lo, hiを指定することで探索範囲を絞り込むことも可能です。デフォルトはaの全体が探索対象です。
'''

'''
素数の判定
'''


def is_prime(n):
    if n == 1: return False

    for k in range(2, int(np.sqrt(n)) + 1):
        
        if n % k == 0:
            return False
            
    return True


'''
npのmaxとmaximumの違い
xs = np.array([1, -2, 3])
np.max(xs, 0)
この出力は3となります．[1, -2, 3]と0の4つの数字のうち，最も大きい値を出力します．

一方で，[max(1, 0), max(-2, 0), max(3, 0)]を出力したい時があります．
その時は，numpyのmaximum関数を用います．

xs = np.array([1, -2, 3])
np.maximum(xs, 0)  

'''

def factorial(x, mod=10**9+7):
    
    
    
    tmp = 1
    for i in range(1, x+1):
        tmp = (tmp * i) % mod
    return tmp
    '''
    Basically, when you do a**d % n, you actually have to calculate a**d, which could be quite large.
    But there are ways of computing a**d % n without having to compute a**d itself, and that is what pow does.
    '''











def main():
    w=1
    steps=0
    state=0
    j=0
    k=0
    le=0
    ans=0
    dic=['A','C','G','T']
    
    
    S=input()

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


    print(ans)
    '''
    out = 0
    tmp = 0
    for s in S:
        if s in 'ACGT':
            tmp += 1
            out = max(tmp, out)
        else:
            tmp = 0
    print(out)
    '''
    
        
    
    

    
    
    
    
    DP = np.zeros(w+1, dtype=int)
    exdp=np.zeros((3,4)) 
    
    
    
        
        
    
    
        
        
    


    "1行1つの整数を入力を取得し、整数と取得する"
    
    
    "12 21 332 とか入力する時に使う"
    "1行に複数の整数の入力を取得し、整数として扱う"
    
    


    
    
    
    '''
    入力
    1234
    出力
    [1, 2, 3, 4]
    '''
    pin_l=["x" for i in range(10)]
    

    ls = ["a", "b", "c", "d", "e"]


    
    

    
    

    
    
    
    
    
    '''
    lsというリストの場合に、1つ飛びの値を取得したい場合には
    ls[::2]
    のようにします。こうすると、
    ["a", "c", "d"]と出力される
    '''

if __name__ == "__main__":
    main()

Solution (Python):
S = input()

out = 0
tmp = 0
for s in S:
  if s in 'ACGT':
    tmp += 1
    out = max(tmp, out)
  else:
    tmp = 0
print(out)

Solution (Python):
s = input()
cnt = 0
ans = 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:
        ans = max(ans, cnt)
        cnt = 0
ans = max(ans, cnt)
print(ans)

Solution (Python):
S = input()

max_cnt = 0
cnt = 0
for c in S:
    if c in "ACGT":
        cnt += 1
        if cnt > max_cnt:
            max_cnt = cnt
    else:
        cnt = 0

print(max_cnt)