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



Sample input:
ATCODER


Sample output:
3

Submission status: Runtime Error

Solution code:
string_list = list(input())
string_len = len(string_list)
renzoku_list = []

def find_letter():
  renzoku = 0
  for i in string_len:
    if string_list[i]=='A':
      renzoku += 1
    elif string_list[i]=='C':
      renzoku += 1
    elif string_list[i]=='G':
      renzoku += 1
    elif string_list[i]=='T':
      renzoku += 1
    else:
      renzoku_list.append(renzoku)
      renzoku = 0

if 'A' in string_list:
  find_letter()
elif 'C' in string_list:
  find_letter()
elif 'G' in string_list:
  find_letter()
elif 'T' in string_list:
  find_letter()
else:
  print(0)
  
max_len = max(renzoku_list)

Submission status: Runtime Error

Solution code:
wlist = list(input())
wlength = 0

for w in wlist:
    if not w in ["A","T","G","C"]:
        tmp = 0
        continue

    else:
        tmp += 1
        if tmp >= wlength:
            wlength = tmp
print(wlength)

Submission status: Runtime Error

Solution code:
S = input()
count = 0
list = []

for c in S:
  if c == 'A' or c == 'C' or c == 'G' or c == 'T':
    count+=1
  else:
    list.append(count)
    count = 0

print(max(list))

Submission status: Runtime Error

Solution code:
string = input()
pattern = ["A","C","G","T"]

c = 0
result = []
for i in string:
    if i in pattern:
        c += 1
    else:
        result.append(c)
        c = 0

print(max(result))

Submission status: Runtime Error

Solution code:
S=list(input())
li = ['A','T','G','C']
maxl=0
ans=0
for i in range(len(S)):
    if S[i] in li:
        leng+=1
    else:
        if leng>maxl:
            maxl=leng
        leng=0
print(maxl)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python
# coding: utf-8

# In[14]:


S=input()
t=list()
ct=0
for i in range(len(S)-1):
    if S[i]=='A' or S[i]=='C' or S[i]=='T' or S[i]=='G':
        i+=1
        ct+=1
    else:
        t.append(ct)
        ct=0
        i+=1
print(max(t))


# In[ ]:

Submission status: Runtime Error

Solution code:
import numpy as np


a = input()

part = ""
s = ["A","C","G","T"]
ans = []

for i in a:
    if  i not in s:
        ans.append(part)
        part = ""
    else:
        part += i


print(len(max(ans)))

Submission status: Runtime Error

Solution code:
S = input()
ans = 0
ans_lis = []
for x in S:
    if x == 'A' or x == 'C'or x == 'G' or x == 'T':
        ans += 1
    else:
        ans_lis.append(ans)
        ans = 0
print(max(ans_lis))

Submission status: Runtime Error

Solution code:
S = input()
count = 0
list = []

for c in S:
  if c == 'A' or c == 'C' or c == 'G' or c == 'T':
    count++
  else:
    list.append(count)
    count = 0
print(max(list))

Submission status: Runtime Error

Solution code:
def solve(b):
    u = []
    lenu = []
    p = ''
    for i in range(len(b)):
        if (b[i]=='A')or(b[i]=='T')or(b[i]=='G')or(b[i]=='C'):
            p += b[i]
        else:
            u.append(p)
            lenu.append(len(p))
            p=p.replace(p,'')
    
    
    # print(u,lenu)
    print(max(lenu))


 
 
def main():
    b = input()
    solve(b)
 
 
if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python
# coding: utf-8

# In[11]:


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


# In[ ]:

Submission status: Runtime Error

Solution code:
s = input()
l = []
for i in range(len(s)):
    if s[i] == 'A' or s[i] == 'T' or s[i] == 'G' or s[i] == 'C':
        l.append(1)
    else:
        l.append(0)
tmp = 0
counter = []
for i in range(len(l)):
    if l[i] == 0:
        counter.append(tmp)
        tmp = 0
    else:
        tmp += 1

print(max(counter))

Submission status: Runtime Error

Solution code:
s = list(input())
lis = ["A","T","G","C"]
ans = []
for i in range(len(s)):
    cnt = 0
    for j in range(len(s)-i):
        if s[i+j] in lis:
            cnt +=1
        else:
            ans.append(cnt)
            break
print(max(ans))

Submission status: Runtime Error

Solution code:
s = input()

max_score = 0
for i in range(len(s)):
  if s[i] == 'A' or s[i] == 'T' or s[i] == 'G' or s[i] == 'C':
    score += 1
  else:
    if max_score < score:
      max_score = score
    score = 0

      
print(max_score)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S = list(input())
ansarr = []
ans = 0
for i in S:
    if ans == 0:
        if i == 'A' or i == 'C' or i == 'G' or i == 'T':
            ans += 1
    else:
        if i == 'A' or i == 'C' or i == 'G' or i == 'T':
            ans += 1
        elif i != 'A' or i != 'C' or i != 'G' or i != 'T':
            ansarr.append(ans)
            ans = 0

print(max(ansarr))

Submission status: Runtime Error

Solution code:
N = input()
atc = ["A","T","C","G"]
ans = []
cnt = 0
for i in range(len(N)):
    if N[i] in atc:
        cnt += 1 
    else:
        ans.append(cnt)
        cnt = 0
print(max(ans))

Submission status: Runtime Error

Solution code:
A = str(input())
S = []
for s in A:
    S.append(s)
ACGT = ["A","C","G","T"]
X = []
cnt = 0
ans = []
for i in range(len(S)):
    if S[i] in ACGT:
        cnt += 1
        continue
    else:
        ans.append(cnt)
        cnt = 0

print(max(ans))

Submission status: Runtime Error

Solution code:
import numpy as np

s=input()
isContinue=0
part=[]

for c in s:
    if c=='A' or c=='T' or c=='C' or c=='G':
        isContinue+=1
    else:
        part.append(isContinue)
        isContinue=0

print(max(part))

Submission status: Runtime Error

Solution code:
from sys import stdin
s = list(stdin.readline().rstrip())
counts=[]
count=0
for i in s:
    if i in ['A','G','C','T']:
        count+=1
    else:
        counts.append(count)
        count=0
print(max(counts))

Submission status: Runtime Error

Solution code:
s = input()
c = 0
ans = []
for a in s:
    if a in ["A", "C","G", "T"]:
        c += 1
    else:
        ans.append(cnt)
        c = 0
print(max(ans))

Submission status: Runtime Error

Solution code:
word = input()
print(len(word.("QWERYUIOPSDFHJKLZXVBNM")))

Submission status: Runtime Error

Solution code:
s = input()
ans = []
a = 0
for i in range(len(s)):
    if s[i] == "A":
        a += 1
    elif s[i] == "C":
        a += 1
    elif s[i] == "G":
        a += 1
    elif s[i] == "T":
        a += 1
    else:
        ans.append(a)
        a = 0
print(max(ans))

Submission status: Runtime Error

Solution code:
S = input()
A = ['A','T','C','G']
res = []
count = 0
for i in S:
    if i in A:
        count += 1
    else:
        res.append(count)
        count = 0
print(max(res))

Submission status: Runtime Error

Solution code:
s = input()
l = 0
l_max = 0
for i in range(len(s)):
  b = S[i]
  if b == 'A' or b == 'C' or b == 'T' or b == 'G':
    l += 1
  else:
    l_max = max(l_max,l)
    l = 0
print(l_max)

Submission status: Runtime Error

Solution code:
N = input()
atc = ["A","T","C","G"]
ans = []
cnt = 0
for i in range(len(N)):
    if N[i] in atc:
        cnt += 1 
    else:
        ans.append(cnt)
print(max(ans))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = input()
A = set(list("ACGT"))
ans = []
for i in range(len(N)):
    cnt = 0
    for n in N[i:]:
        if n in A:
            cnt += 1
        else:
            ans.append(cnt)
            break
print(max(ans))

Submission status: Runtime Error

Solution code:
s=input()
cnt=0
cntlen=[]
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:
        cntlen.append(cnt)
        cnt=0
print(max(cntlen))

Submission status: Runtime Error

Solution code:
from sys import stdin

S = stdin.readline().rstrip()

countlist = []

count = 0
for s in S:
    if s == "A" or s == "C" or s == "G" or s == "T":
        count += 1
    else:
        countlist.append(count)
        count = 0

print(max(countlist))

Submission status: Runtime Error

Solution code:
S=input()
ls=[]
tmp=0
aaa=['A', 'T', 'G', 'C']
for i in range(len(S)):
	if S[i] not in aaa:
		ls.append(tmp)
		tmp=0
		continue
	else:
		tmp+=1
print(max(ls))

Submission status: Runtime Error

Solution code:
import re

def solve():
  S = input()
  parts = re.split(r'[^ACGT]', S)
  return max(*map(lambda s: len(s), parts))

print(solve())

Submission status: Runtime Error

Solution code:
#=map(int,input().strip().split())
#=int(input().strip())
#=list(map(int,input().strip().split()))
S = input()

subs = []
tmp = []
for s in S:
    if "A" == s or "C" == s or "G"== s or "T" == s:
        tmp.append(s)
    else:
        subs.append(tmp)
        tmp = []
rs = sorted(subs,key=lambda x: len(x),reverse=True)
print(len(rs[0]))

Submission status: Runtime Error

Solution code:
a=list(input())
count=0
kekka=[]
for i in range(len(a)):
    if a[i]=="A" or a[i]=="T" or a[i]=="C" or a[i]=="G":
        count+=1
    else:
        kekka.append(count)
        count=0
print(max(kekka))

Submission status: Runtime Error

Solution code:
s = str(input())
a = []
b = ["A", "T", "G", "C"]
c = ""
for s_ in s:
    
    if s_ in b:
        c = c + s_
    else:
        a.append(c)
        c = ""
aa = [len(i) for i in a]
print(max(aa))

Submission status: Runtime Error

Solution code:
s=input()
ans=0
cnt=[]
for i in s:
    if i=="A" or i=="C" or i=="G" or i=="T":
        ans+=1
    else:
        cnt.append(ans)
        ans=0
print(max(cnt))

Submission status: Runtime Error

Solution code:
s=input()
l=['A','C','G','T']
ans=[];ct=0
for i in range(len(s)):
  if s[i] in l:
    ct+=1
  else:
    ans.append(ct)
print(max(ans))

Submission status: Runtime Error

Solution code:
s = input()
cnt = 0
res = []
for a in s:
    if a in ["A", "G", "C", "T"]:
        cnt += 1
    else:
        res.append(cnt)
        cnt = 0
print(max(res))

Submission status: Runtime Error

Solution code:
s=input()
ans=0
l=[]
for i in range(len(s)):
    if s[i] not in "ACGT":
        l.append(ans)
        ans=0
    else:
        ans+=1
print(max(l)or 0)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-


def is_acgt(s):
    if s=='A' or s=='C' or s=='G' or s=='T':
        return 1
    else: return 0


x = raw_input()


count = []
c = 0
for s in x:
    a = is_acgt(s)
    if a == 0:
        count.append(c)
        c = 0
    else:
        c += 1


print max(count)

Submission status: Runtime Error

Solution code:
S = list(input())
list = []
temp = ""
for i in range(len(S)):
    if S[i] == 'A' or S[i] == 'T' or S[i] == 'G' or S[i] == 'C':
        temp += S[i]
    else:
        list.append(temp)
        temp = ""
#print(list)
ans = []
for i in range(len(list)):
    ans.append(len(list[i]))
#print(ans)
print(max(ans))

Submission status: Runtime Error

Solution code:
s=input()

le=0
i=0
while(i<len(s)):
    l=0
    while(s[i]=='A' or s[i]=='C' or s[i]=='G' or s[i]=='T'):
        l+=1
        i+=1

    if(l>le):
        le=l
    l=0
    i+=1
print(le)

Submission status: Runtime Error

Solution code:
S = input()

count = 0
C = []
for i in list(S):
  if i == "A" or i == "C" or i == "G" or i == "T":
    count += 1
  else:
    C.append(count)
    count = 0

print(max(C))

Submission status: Runtime Error

Solution code:
s = raw_input().strip()
print max(j - i for i in range(len(s)) for j in range(i, len(s)+1) if s[i:j] == set('ACGT'))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s = list(input())
cnt = 0
list = []
for i in range(len(s)):
    if s[i] == "A" or s[i] == "T" or s[i] == "C" or s[i] == "G":
        cnt += 1
    else:
        list.append(cnt)
        cnt = 0
print(max(list))

Submission status: Runtime Error

Solution code:
s,a,x=input(),[],["A","C","G","T"]
b=""
for i in range(len(s)):
  if s[i] in x:b+=s[i]
  else:
    a.append(b)
    b=""
a.sort()
print(len(a[-1]))

Submission status: Runtime Error

Solution code:
S = input()

result = []
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:
        result.append(count)
        count = 0

print(max(result))

Submission status: Runtime Error

Solution code:
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy
from operator import itemgetter
#以下てんぷら
def j(q):
    if q==1: print("Yes")
    else:print("No")
    exit(0)


def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")

def ip():
    return int(input())

def pne(n):
    print(n,end='')

rem = pow(10,9)+7

#n = ip()                                     #入力整数1つ
#x,y= (int(i) for i in input().split())       #入力整数横2つ以上
#a = [int(i) for i in input().split()]        #入力整数配列
a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[input() for i in range(n)]    #入力セット(整数改行あり)(2/2)

#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
#こっから本文
b = ["A","C","T","G"]
s = []
c = 0
for i in range(len(a)):
    if a[i] in b:
        c+=1
    else:
        s.append(c)
        c=0
print(max(s))