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

for i in len(S):
  s = S[i]
  TF = any(['A'==s, 'C'==s, 'G'==s, 'T'==s])
  if TF:
    L += 1
  elif L >= max_L:
    max_L = L
    L = 0

print(max_L)

Submission status: Runtime Error

Solution code:
import re 
S = input()

p = re.compile('[ATCG]+')
f = p.finditer

candidate = [i.span()[1]- i.span()[0] for i in f]
if candidate == [] :
    print(0)
else :
    print(max(candidate))

Submission status: Runtime Error

Solution code:
s=input()
a=[]
b=['A','T','G','C']
for i in len(s):
  if s[i] in b:
    a.append(0)
  else:
    a.append(/)
c=a.split(/)
d=0
for j in len(c):
  if len(c[j])>d:
    d=len(c[j])
print(d)

Submission status: Runtime Error

Solution code:
s=input()
a=[]
b=['A','T','G','C']
for i in len(s):
  if s[i] in b:
    a.append(0)
  else:
    a=a
print(len(a))

Submission status: Runtime Error

Solution code:
s=input()
a=[]
b=['A','T','G','C']
for i in len(s):
  if s[i] in b:
    a.append(0)
print(len(a))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
b = input()
 
if  "A"==b
    print("T")
elif "C"==b
    print("G")
elif "T"==b
    print("A")
else:
    print("C")

Submission status: Runtime Error

Solution code:
S = input()
N = len(S)
atcg_lst = []
for n in range(N):
    for m in range(n, N):
        s = S[n:m+1]
        atcg = ["ATCG".count(ss) for ss in s]
        if all(atcg):
            atcg_lst.append(sum(atcg))
print(max(atcg_lst))

Submission status: Runtime Error

Solution code:
S = list(input())
N = len(S)
for i in range(N):
    if S[i] is not 'A' or 'T' or 'G' or 'C':
        S.remove(S[i])
print(len(S))

Submission status: Runtime Error

Solution code:
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
print(max(listResult))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s = ns()
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)

Submission status: Runtime Error

Solution code:
s = ns()
atcg = "ATCG"

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)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3

arg = list(input())

if not set(arg) & set('ACGT'):
  print(0)

index_list = []
index_list += [i for i, x in enumerate(arg) if x == 'A']
index_list += [i for i, x in enumerate(arg) if x == 'C']
index_list += [i for i, x in enumerate(arg) if x == 'G']
index_list += [i for i, x in enumerate(arg) if x == 'T']
index_list = sorted(index_list)

index = 0
count = 1
ans_i = 0
anses = []

while ( index + 1 ) <= len(index_list):

  if ( index + 1 ) == len(index_list):
    anses.append(count)
  elif index_list[index] + 1 == index_list[index+1]:
    count = count + 1
  else:
    anses.append(count)
    count, ans_i = 1, ans_i + 1

  index = index + 1

print(max(anses))

Submission status: Runtime Error

Solution code:
str_arr = input().split()
atcg = ['A', 'T', 'C', 'G']

forward = 0
for i in range(len(str_arr)):
  if str_arr[i] in atcg:
  	break
  else:
    forward += 1

backward = len(str_arr)
for i in range(len(str_arr)):
  if str_arr[len(str_arr) - i] in atcg:
  	break
  else:
    backward -= 1
    
print(len(str_arr) - forward - backward)

Submission status: Runtime Error

Solution code:
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:
        if s != '':
            sub_list.append(len(s))
        s = ''
print(max(sub_list))

Submission status: Runtime Error

Solution code:
atcoder = input()
ACGT = 'ACGT'

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

print(max(sub_list))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#include<stdio.h>

int main(){
	char S[5] = "ACGT";
	char scanS[10];
	int i , j;
	int count = 0 , countMax = 0;
	scanf("%s" , scanS);
	for(i = 0 ; scanS[i] != '\0' ; i++){
		for(j = 0 ; S[j] != '\0' ; j++){
			if(scanS[i] == S[j]) {
				count++;
				break;
			}	
		}
		if(j == 4) count = 0;
		if(count > countMax) countMax = count;
	}
	
	printf("%d\n" , countMax);
	return 0;
}

Submission status: Runtime Error

Solution code:
S = input()
2 N = len(S)
3 ans = 0
4 for i in range(N):
5 for j in range(i, N):
6 if all('ACGT'.count(c) == 1 for c in S[i : j + 1]):
7 ans = max(ans, j - i + 1)
8 print(ans)

Submission status: Runtime Error

Solution code:
s=input()
res=0
for i in range(len(s)+1):
    for j in range(i+1,len(s)+1):
       
        if set(list(s[i:j]))|{'A','G','C','T'}=={'A','G','C','T'}:
            cnt=len(s[i:j])
        if res<cnt:
            res=cnt

print(res)

Submission status: Runtime Error

Solution code:
s=input()
res=0
for i in range(len(s)+1):
    for j in range(i+1,len(s)+1):
        print(list(s[i:j]))
        if set(list(s[i:j]))|{'A','G','C','T'}=={'A','G','C','T'}:
            cnt=len(s[i:j])
        if res<cnt:
            res=cnt

print(res)

Submission status: Runtime Error

Solution code:
s=input()
res=0
for i in range(len(s)):
    for j in range(i+1,len(s)):
        if set(list(s[i:j]))|{'A','G','C','T'}=={'A','G','C','T'}:
            cnt=len(s[i:j])
        if res<cnt:
            res=cnt

print(res)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
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

print(max(lst)

Submission status: Runtime Error

Solution code:
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

print(max(lst))

Submission status: Runtime Error

Solution code:
S = str(input())
k = []
for l in range(len(S)+2):
  k.append(0)
i = 0
while True:
  if (i == len(S)-1):
      break
  while True:
    if not((S[i] == "A")or(S[i] == "C")or(S[i]=="G")or(S[i] == "T")):
      break
    else:
      k[i+1] = k[i]+1
    i += 1
k.sort(reverse=True)
print(k[0])

Submission status: Runtime Error

Solution code:
S = str(input())
k = []
for l in range(S+2):
  k.append(0)
for i in range(S):
  while True:
    if not((S[i] == "A")or(S[i] == "C")or(S[i]=="G")or(S[i] == "T")):
      break
    else:
      k[i+1] = k[i]+1
      i += 1
k.sort(reverse=True)
print(k[0])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S = input()

ACGT = []
str=''

for x in S:
    if x=='A' or x=='C' or x=='G' or x=='T':
        str += x
    else:
        ACGT += [str]
        str = ''

print(len(max(ACGT)))

Submission status: Runtime Error

Solution code:
s = input()
atcg = ["A", "T", "C", "G"]
index = []
for i in range(len(s)-1):
  if s[i] not in atcg:
    index.append(i)

max = index[0]
for i in range(1, len(index), 1):
  if index[i] - index[i-1] - 1> max:
    max = index[i] - index[i-1] - 1 
print(max)

Submission status: Runtime Error

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

max = 0
for i in range(len(s)-1):
  j = i
  while s[j] in atcg:
    if max <= j - i + 1:
      max = j - i + 1
    j += 1
      
print(max)

Submission status: Runtime Error

Solution code:
S = input()
Slist =　list(S)

i = 0
max = 0
for s in Slist:
  if s == "A" or "C" or "G" or "T":
    i += 1
    if i >= max:
      max = i
  elif:
    i = 0
    
print(max)

Submission status: Runtime Error

Solution code:
n=0
l=[]
for i in input():
  if i in ["A","C","G","T"]:
    n+=1
  else:
    l.append(n)
    n=0
print(max(l))

Submission status: Runtime Error

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

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

print(maxi)

Submission status: Runtime Error

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

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

print(maxi)

Submission status: Runtime Error

Solution code:
 S = 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
  else:
    result.append(count)
    count = 0

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

print(maxi)

Submission status: Runtime Error

Solution code:
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
  else:
    result.append(count)
    count = 0

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

print(maxi)

Submission status: Runtime Error

Solution code:
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
  else:
    result.append(count)
    count = 0

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

print(max)

Submission status: Runtime Error

Solution code:
S = str(input())

count = 0
result = []

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

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

print(max)

Submission status: Runtime Error

Solution code:
n=0
l=[]
for i in input():
  if i in ["A","C","G","T"]:
    n+=1
  else:
    l.append(n)
    n=0
print(l.max())

Submission status: Runtime Error

Solution code:
s = list(input())
acgt = ["A", "C", "G", "T"]
cnt, 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)

Submission status: Runtime Error

Solution code:
s = list(input())
acgt = ['A', 'C', 'G', 'T']
cnt, 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)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
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)
counter = 0
multi = 1
max_counter = 0
for first in range(len(binary_list)):
    if binary_list[first] == 1:
        while(multi):
            multi *= binary_list[first]
            if multi == 0:
                break
            first += 1
            counter += 1
            if counter >= max_counter:
                max_counter = counter
print(max_counter)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# B - ATCoder
s = input()
wordList = 'ACGT'
t = []
tmp = []
for i in range(len(s)):
    if s[i] in wordList:
        tmp.append(s[i])
    if not (s[i] in wordList):
        t.append(tmp)
        tmp = []
print(max(len(i) for i in t))

Submission status: Runtime Error

Solution code:
s = input()
acgt = []
cnt = 0
for a in s:
    if a == 'A' or a == 'C' or a == 'T' or a == 'G':
        cnt += 1
    else:
        acgt.append(cnt)
        cnt = 0
acgt.appen(cnt)
print(max(acgt))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if __name__ == '__main__':
   main()

Submission status: Runtime Error

Solution code:
b = input()
c = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
print (c[b])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = input()
answer_list = []
answer = 0

for i in range(len(N)):
    if N[i] == "A" or N[i] == "T" or N[i] == "C" or N[i] == "G":
        answer += 1
    else:
        answer_list.append(answer)
        answer = 0
print(max(answer_list))

Submission status: Runtime Error

Solution code:
s = input()
ans = []
counter = 0
for i in s:
    if i in 'ATGC':
        counter += 1
    else:
        ans.append(counter)
        counter = 0
print(max(ans))

Submission status: Runtime Error

Solution code:
s = input()
ans = []
counter = 0
for i in s:
    if i in 'ATGC':
        counter += 1
    else:
        ans.append(counter)
        conuter = 0
print(max(ans))

Submission status: Runtime Error

Solution code:
s = input()
ans = []
counter = 0
for i in s:
    if i in 'ATGC':
        counter += 1
    else:
        ans.append(counter)
        conter = 0

print(max(ans))

Submission status: Runtime Error

Solution code:
s=input()
i=1
n=0
ans=[]
sta=0
 
while i<=len(s):
  if s[i-1]=='A'or s[i-1]=='C' or s[i-1]=='G' or s[i-1]=='T':
    n=n+1
    sta=1
  elif sta==1:
    ans.append(n)
    n=0
    
  i=i+1
if sta==0:
  ans=[0]
  
print(max(ans))

Submission status: Runtime Error

Solution code:
s=input()
i=1
n=0
ans=[]
sta=0
 
while i<=len(s):
  if s[i-1]=='A'or s[i-1]=='T' or s[i-1]=='C' or s[i-1]=='G':
    n=n+1
    sta=1
  elif sta==1:
    ans.append(n)
    n=0
    
  i=i+1
if sta==0:
  ans=[0]
  
print(max(ans))

Submission status: Runtime Error

Solution code:
i=1
n=0
ans=[]
sta=0
 
while i<=len(s):
  if s[i-1]=='A'or s[i-1]=='C' or s[i-1]=='G' or s[i-1]=='T':
    n=n+1
    sta=1
  elif sta==1:
    ans.append(n)
    n=0
    
  i=i+1
if sta==0:
  ans=[0]
  
print(max(ans))

Submission status: Runtime Error

Solution code:
s=input()
i=1
n=0
ans=[]
sta=0
 
while i<=len(s):
  if s[i-1]=='A'or s[i-1]=='T' or s[i-1]=='C' or s[i-1]=='G':
    n=n+1
    sta=1
  elif sta==1:
    ans.append(n)
    n=0
    
  i=i+1
if sta==0:
  ans=[0]
  
print(max(ans))

Submission status: Runtime Error

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

wlist=[]
answer=[]
for word in S:
    if word in acgt:
        wlist.append(word)
    else:
        print(wlist)
        answer.append(len(wlist))
        wlist=[]

print(max(answer))

Submission status: Runtime Error

Solution code:
s=input()
i=1
ans=''
 
while i<=len(s):
  if s[i-1]=='A'|s[i-1]=='C'|s[i-1]=='G'|s[i-1]=='T':
    ans=ans+s[i-1]
  i=i+1
 
print (len(ans))

Submission status: Runtime Error

Solution code:
s=input()
i=1
ans=''
 
while i<=len(s):
  if s[i-1]=='A'|s[i-1]=='C'|s[i-1]=='G'|s[i-1]=='T':
    ans=ans+s[i-1]
  i+=1
 
print (len(ans))

Submission status: Runtime Error

Solution code:
s=input()
i=1
ans=''

while i<=len(s):
  if s[i-1]=='A'|s[i-1]=='C'|s[i-1]=='G'|s[i-1]=='T':
    i=i+ans
  i+=1

print (len(ans))

Submission status: Runtime Error

Solution code:
S = input()
max_l = 0
temp_l = 0

for s in S:
    if s == 'A' or s=='G' or s=='C' or s=='T':
        temp_l += 1
        
    else:
      	max_l = max(max_l, temp_l)
        temp_l = 0

print(max_l)

Submission status: Runtime Error

Solution code:
s = input()
res = 0
for i in range(len(s)):
    cnt = 0
    while s[i]=="A" or s[i]=="C" or s[i]=="G" or s[i]=="T":
        cnt += 1
        i += 1
    res = max(res,cnt)
print(res)

Submission status: Runtime Error

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

list=[]
answer=[]
for word in S:
    if word in acgt:
        list.append(word)
    else:
        answer.append(len(list))
        list=[]

print(max(answer))

Submission status: Runtime Error

Solution code:
S = input()

ok_list = ["A", "C", "G", "T"]
ans_list = []
ans = 0

for i in S:
  if i in ok_list:
    ans += 1
  else:
    ans_list.append(ans)
    ans = 0

print(max(ans_list))

Submission status: Runtime Error

Solution code:
s = str(input())

#0文字の場合をチェック
if ("A" not in s) and ("C" not in s) and ("G" not in s) and ("T" not in s):
    print 0

max = 0
for i, c in enumerate(s):
    if is_ACGT(c):
        if i == (len(s) - 1):
            break
        max = get_ACGT_length(s[i+1:])

print(max)

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

def get_ACGT_length(s):
    if len(s) == 0:
        return 0

    if not is_ACGT(s[0]):
        return 0

    if len(s) == 1:
        return 1
    return 1 + get_ACGT_length(s[1:])

Submission status: Runtime Error

Solution code:
S = input()
max = 0
for i in range(len(S)):
    if S[i] in 'ACGT':
        for j in range(i+1, len(S)):
            if not S[j] in 'ACGT':
                break
        max = (j - i) if max < (j - i) else max 
print(max)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def function(S):
    ACGT = ['A', 'C', 'G, 'T']
    ret = 0
    N = len(S)
    for i in range(0, N):
        for j in range(i+1, N+1):
            temp = 0
            l = S[i:j]
            for x in l:
                if x not in ACGT:
                    break
            temp = len(l)
    	if temp >= ret:
        	ret = temp
    return ret

Submission status: Runtime Error

Solution code:
str = input()
ans = ''
tmp = ''
for s in str:
  if (s in ['A', 'T', 'G', 'C']):
    tmp += s
    if (len(tmp) > len(ans):
        ans = tmp
  else:
    tmp = ''

print(ans)

Submission status: Runtime Error

Solution code:
def function(S):
    ACGT = ['A', 'C', 'G, 'T']
    ret = 0
    N = len(S)
    for i in range(0, N):
        for j in range(i+1, N+1):
            l = S[i:j]
            for x in l:
                if x not in ACGT:
                    break
            ret = len(l)
    return ret

Submission status: Runtime Error

Solution code:
n=input()
dic = {'A': True, 'C': True, 'G': True, 'T': True}
lens = []

for i in range(0, len(n)):
    length = 0
    s = n[i]

    if s not in dic:
        lens.append(length)
        continue

    length += 1
    for j in range(i+1, len(n)):
        t = n[j]
        if t not in dic:
            lens.append(length)
            continue

        length += 1

print(max(lens))

Submission status: Runtime Error

Solution code:
str = input()
ans = []
allow = ["A","C","G","T"]
count = 0
for s in str:
  if s in allow:
    count = count + 1
    ans.append(count)
  else:
    count = 0
  
print(sorted(ans)[-1])

Submission status: Runtime Error

Solution code:
str = input()
ans = []
allow = ["A","C","G","T"]
count = 0
for index in range(len(str)):
  if str[index] in allow:
    count = count + 1
  else:
    ans.append(count)
    count = 0
print(sorted(ans)[-1])

Submission status: Runtime Error

Solution code:
str = input()
ans = []
allow = ["A","C","G","T"]
ans_str = ""
for index in range(len(str)):
  if str[index] in allow:
    ans_str = ans_str + str[index]
  else:
    ans.append(ans_str)
    ans_str = ""
print(len(sorted(ans, key=len)[-1]))

Submission status: Runtime Error

Solution code:
str = input()
ans = []
allow = ["A","C","G","T"]
ans_str = ""
for index in range(len(str)):
  if str[index] in allow:
    ans_str = ans_str + str[index]
  else:
    ans.append(ans_str)
    ans_str = ""
    continue
 
print(len(sorted(ans, key=len)[-1]))

Submission status: Runtime Error

Solution code:
str = input()
ans = []
allow = ["A","C","G","T"]
ans_str = ""
for index in range(len(str)):
  if str[index] in allow:
    ans_str = ans_str + str[index]
  else:
    ans.append(ans_str)
    ans_str = ""
    continue

print(len(sorted(ans, key=len)[-1]))

Submission status: Runtime Error

Solution code:
str = input()
ans = []
allow = ["A","C","G","T"]
ans_str = ""
for index in range(len(str)):
  if str[index] in allow:
    ans_str = ans_str + str[index]
  else:
    ans.append(ans_str)
    ans_str = ""
    continue

print(sorted(ans, key=len)[-1])

Submission status: Runtime Error

Solution code:
s=input()
at='ACGT'
cnt=0
ans=[]
for i in s:
    if i in at:
        cnt+=1
    else:
        ans+=[cnt]
        cnt=0
print(max(ans))

Submission status: Runtime Error

Solution code:
S=list(input())

count=0
max=0

for moji in list:
  if moji==("A"or"T"or"G"or"C"):
    count+=1
    if count>max:
      max=count
  else:
    count=0
print(max)

Submission status: Runtime Error

Solution code:
    S = input()
     
    cnt = 0
    max = 0
    for str in S:
      if str in {'A', 'C', 'G', 'T'}:
        cnt += 1
      else:
        if max < cnt:
          max = cnt
        cnt = 0
     
    print(cnt)

Submission status: Runtime Error

Solution code:
a = input()
count = 0
mx = 0
for i in range(len(a)):
	if a[i] == "A" or a[i] == "C" or a[i] == "G" or a[i] == "T":
      count += 1
    else:
      count = 0
    if ma < count:
      mx = count
print(mx)

Submission status: Runtime Error

Solution code:
S = input()

ans = 0
ACGT = set('A','C','G','T')
for i in range(1,len(S+1)):
  j = 1
  while j*i <= len(S):
    if set(S[j:j*i]) <= ACGT:
      ans = len(S[j:j*i])
    j += 1
print (ans)

Submission status: Runtime Error

Solution code:
S = input()

ans = 0
ACGT = set('A','C','G','T')
for i in range(1,len(S+1)):
  j = 1
  while j*i <= S:
    if set(S[j:j*i]) <= ACGT:
      ans = len(S[j:j*i])
    j += 1
print (ans)

Submission status: Runtime Error

Solution code:
S = input()

ans = 0
ACGT = set('A','C','G','T')
for i in len(1,S+1):
  j = 1
  while j*i <= S:
    if set(S[j:j*i]) <= ACGT:
      ans = len(S[j:j*i])
    j += 1
print (ans)

Submission status: Runtime Error

Solution code:

S = input()
ans = 0
count = 0

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

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
string = input()
ch = string[0]
max_string_len = 0
prev_len = 0
for idx,ch in enumerate(string):
  if ch  in {"A","T","G","C"}:
    prev_len += 1
  	max_string_len = max(max_string_len,prev_len)
  else:
    prev_len = 0
    
print(max_string_len)

Submission status: Runtime Error

Solution code:
inp = input()
res = 0
for i in range(len(inp)):
	for j in range(i, len(inp)):
    	if len([w for w in inp[i:j] if w in ["A", "C", "G", "T"]]) == (j-i):
        	res = max(res, j-i)
print(res)

Submission status: Runtime Error

Solution code:
S = input()
list = []
j = -1
for i in range(0, len(S)):
    if not(S[i]=="A" or S[i]=="C" or S[i]=="G" or S[i]=="T"):
        list.append(i-j-1)
        j = i
print("{}".format(max(list)))

Submission status: Runtime Error

Solution code:
import numpy as np
inp = input()
ACGT = ["", "A", "C", "G", "T"]
sentences = [j+K+m+n for j in ACGT for k in ACGT for m in ACGT for n in ACGT]
length = [len(sent) for sent in sentences if sent in inp]
print(np.max(length))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import re
print(max(map(len,re.finditer('[ACGT]*',input()))))

Submission status: Runtime Error

Solution code:
import re
print(max(len(x[0]) for x in re.finditer('[ACGT]*',input())))

Submission status: Runtime Error

Solution code:
S = input()
N = len(S)
jogai = 'BDEFHIJKLMNOPQRSUVWXYZ'
cnt = []
for i in range(0,N):
    for j in range(1,N+1):
        tmp = S[i:j]
        flg = 1
        for a in jogai:
            if a in tmp:
                flg = 0
        if flg:
            cnt.append(len(tmp))
print(max(cnt))

Submission status: Runtime Error

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

alp = 'ACGT'

cnt = []

for i in range(0, N):
    for j in range(i, N+1):
        tmp = S[i:j]
        flg = 0
        for a in alp:
            if a in tmp:
                flg = 1
        if flg:
            cnt.append(len(tmp))

print(max(cnt))

Submission status: Runtime Error

Solution code:
S = input()

jogai = 'BDEFHIJKLMNOPQRSUVWXYZ'
cnt = []
for i in range(0,len(S)):
    for j in range(1,len(S)+1):
        tmp = S[i:j]
        flg = 1
        for a in jogai:
            if a in tmp:
                flg = 0
        if flg:
            cnt.append(len(tmp))
print(max(cnt))

Submission status: Runtime Error

Solution code:
S = input()

jogai = "ZXVBNMLKJHFDSQWERYUIOP"
cnt = []
for i in range(0,len(S)):
    for j in range(1,len(S)+1):
        tmp = S[i:j]
        flg = 1
        for a in jogai:
            if a in tmp:
                flg = 0
        if flg:
            cnt.append(len(tmp))
print(max(cnt))

Submission status: Runtime Error

Solution code:
S = input()

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

Submission status: Runtime Error

Solution code:
def findloc(var):
	var = str(var)
	floc = var.find('A') or var.find('C') or var.find('G') or var.find('T')
	return floc
var = input()
floc = findloc(var)
print(findloc(var))
var_list = list(var)
currentnum = 0
if str(floc) == "-1":
	print("0")
else:
	for ch in var_list:
		if str(sliced) != "-1":
			flocadd = int(floc) + currentnum
			sliced = var_list[flocadd:]
			sliced = "".join(sliced)
			currentnum += 1
			#if findloc(sliced) != "-1":
		else:
			print(currentnum)
			break

Submission status: Runtime Error

Solution code:
n = input();ans="ACGT";k=ans.index(n)^3;print(ans[k])

Submission status: Runtime Error

Solution code:
S = input()
lis_S = list(S)
Ans = 0
for char in lis_S:
    if char=="A" or char=="C" or char=="G" or char=="T":
        Ans += 1
    elif index < len(lis_S):
        continue
    else:
        break
print(Ans)

Submission status: Runtime Error

Solution code:
A = list(input())
N = int(len(A))
c= []
cnt = 0
cnt2 = 0
for j in range(N-1):
    if ((str(A[j]) == "A" or str(A[j]) == "T" or str(A[j]) == "C" or str(A[j]) == "G") and (str(A[j+1]) == "A" or str(A[j+1]) == "T" or str(A[j+1]) == "C" or str(A[j+1]) == "G")):
        cnt += 1
    elif(str(A[j]) == "A" or str(A[j]) == "T" or str(A[j]) == "C" or str(A[j]) == "G"):
        cnt2 += 1
    else: 
        t = cnt + 1
        c.append(t)
        cnt = 0
if cnt2 == 0:
    print('0')
else:      
    print(max(c))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# coding: utf-8
string = list(input())
num = 0
numlist = []
for i in range(len(string)):
    if string[i] == "A" or string[i] == "T" or string[i] == "G" or string[i] == "C":
            num += 1
    else:
        numlist.append(num)
        num = 0
print(max(numlist))