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: Wrong Answer

Solution code:
C = input()
ans = 0
match = 0

for i in C:
    if ((i.find('A')) or (i.find('C')) or \
        (i.find('G')) or (i.find('T'))) == 0:
            ans += 1
    else:
        if ans >= match:
            match = ans
            ans = 0
        ans = 0
print(match)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import re
s = input()
re_s = re.sub('[ACGT]', '1', s)
count = 0
ans = 0
for i in range(len(s)):
    if re_s[i] == '1':
        count += 1
    else:
        ans = max(ans,count)
        count = 0
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
maxl = 0
for begin in range(len(S)):
  for end in range(begin, len(S)):
    if all([x in 'ACGT' for x in S[begin:end]]):
      maxl = max(maxl, end - begin)

print(maxl)

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline

s = list(input().rstrip())

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

for i in range(len(s)):
    for j in range(4):
        if (s[i] == lis[j]):
            s[i] = '!'
            break

print(s)
ct = 0
ct_lis = []

for i, x in enumerate(s):
    print(ct_lis)
    if (x == '!'):
        ct += 1
    else:
        ct_lis.append(ct)
        ct = 0

ct_lis.append(ct)

print(max(ct_lis))

Submission status: Wrong Answer

Solution code:
s = input()
count = 0
for i in range(len(s) - 1):
  if s[i] == "A" or s[i] == "T" or s[i] == "G" or s[i] == "C":
    len_count = 1
    for j in range(len(s) - i - 1):
      if s[i+j+1] == "A" or s[i+j+1] == "T" or s[i+j+1] == "G" or s[i+j+1] == "C":
        if j < len(s) - i - 2:
          len_count += 1
        else:
          if count < len_count:
            count = len_count
          break
      else:
        if count < len_count:
          count = len_count
        break
print(count)

Submission status: Wrong Answer

Solution code:
S = input()
atgc = ['A','T','G','C']
flag = True
count = 0
max = 0

for c in S:
  if (c in atgc):
    if not flag:
      count = 0
    count += 1
    if max < count:
      max = count
  else:
    flag = False
    count = 0
    
print(max)

Submission status: Wrong Answer

Solution code:
S = input()
atgc = ['A','T','G','C']
flag = True
count = 0
max = 0

for c in S:
  if (c in atgc) and flag:
    count += 1
    if max < count:
      max = count
  else:
    flag = False
    count = 0
    
print(max)

Submission status: Wrong Answer

Solution code:
S=input()

c=m=0
for x in S:
  #print((m,c,x,"ACGT".find(x)))
  if "ACGT".find(x)<0:
    m = max(m, c)
    c = 0
  c+=1

print(m-1)

Submission status: Wrong Answer

Solution code:
from sys import stdin
S = stdin.readline().rstrip()
ans = 0
sl = 0
for _ in S:
    if _ in "AGCT":
        sl+=1
    else:
        if sl > ans:
            ans=sl
        sl = 0
print(ans)

Submission status: Wrong Answer

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

import re

S = re.sub("[ACGT]", "-", input())

for i in range(1, 11):
    if not ("-" * i) in S:
        print(i - 1)
        break

Submission status: Wrong Answer

Solution code:
import sys

S = list(input())

length = 0
maxlen = 0

for s in S:
	if s == 'A' or s == 'T' or s == 'C' or s == 'G' :
		length += 1
	else :
		if length > maxlen:
			maxlen = length
		length = 0

print(maxlen)

Submission status: Wrong Answer

Solution code:
import sys

S = list(input())

length = 0
maxlen = 0
maxi = 0
temp = 0

for i,s in enumerate(S):
	if s == 'A' or s == 'T' or s == 'C' or s == 'G' :
		if length == 0:
			temp = i
		length += 1
	else :
		if length > maxlen:
			maxlen = length
			maxi = temp
		length = 0

#for i in range(maxlen):
#	print(S[maxi+i],end="")
print(maxlen)

Submission status: Wrong Answer

Solution code:
s = input()

l = 0
a = 0

for c in s:
    if c in "a↨c↨g↨t↨":
        l += 1
        a = max(a,l)
    else:
        l = 0
        
print(a)

Submission status: Wrong Answer

Solution code:
ACGT = ['A','C','G','T']
s = input()
l,count = 0,0
for i in range(len(s)):
	if s[i] in ACGT:
		count += 1
	else:
		if l < count:
			l = count
		count = 0
print(l)

Submission status: Wrong Answer

Solution code:
S = input()
l = []
for i in S:
    l.append(i)

c = 0
cnt = []
for j in range(len(l)):
    if l[j] == 'A' or l[j] == 'T' or l[j] == 'C' or l[j] == 'G':
        c+=1
        cnt.append(c)
    else:
        cnt.append(c)
        c = 0

print(cnt)
print(max(cnt))

Submission status: Wrong Answer

Solution code:
S = input()
l = []
for i in S:
    l.append(i)

c = 0
for j in range(len(l)):
    if l[j] == 'A' or l[j] == 'T' or l[j] == 'C' or l[j] == 'G':
        c+=1
print(c)

Submission status: Wrong Answer

Solution code:
S = list(input())
st = [0]*len(S)
string = "ACGT"
for i in range(len(S)):
    if S[i] in string:
        st[i] += 1

st_1 = [1]*len(S)

count = []
temp = 0

for i in range(len(st)):
    if st[i] == st_1[i]:
        temp += 1
    else:
        count.append(temp)
        temp = 0
    if i+1 == len(st):
        count.append(temp)
        
print(st)
if count:
    print(max(count))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
S = list(input())
st = [0]*len(S)
string = "ACGT"
for i in range(len(S)):
    if S[i] in string:
        st[i] += 1

st_1 = [1]*len(S)

count = []
temp = 0
for i in range(len(st)):
    if st[i] == st_1[i]:
        temp += 1
    else:
        count.append(temp)
        temp = 0
        
#print(st)
if count:
    print(max(count))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
t = input()
acgt = ["A", "C", "G", "T"]

i = 0
j = 0
for c in t:
  if c in acgt:
    i += 1
  else:
    j = max(i,j)
    i = 0

print(j)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

s = input()
t = ['A','T','C','G']

count = 0
length = 0

for i in s:
    if i in t:
        count += 1
    elif count > length:
        length = count
        count = 0
    else:
        continue

print(count) if count == len(s) else print(length)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

s = input()
t = ['A','T','C','G']

count = 0
length = 0

for i in s:
    if i in t:
        count += 1
    elif count > length:
        length = count
        count = 0

print(count) if count == len(s) else print(length)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

s = input()
t = ['A','T','C','G']

count = 0
len = 0

for i in s:
    if i in t:
        count += 1
    elif count > len:
        len = count
        count = 0

print(len)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

s = input()
t = ['A','T', 'C','G']

count = 0
len = 0

for i in s:
    if i in t:
        count += 1
    elif count > len:
        len = count
        count = 0

print(len)

Submission status: Wrong Answer

Solution code:
b = input()
len = len(b)
ACGT = 0
MAX = 0
flag = 0
for i in range(len):
  if b[i]=="A" or b[i]=="C" or b[i]=="G" or b[i]=="T":
    ACGT += 1
  else:
    if MAX < ACGT:
      MAX = ACGT
    ACGT = 0
    flag = 1
if flag ==0:
  MAX=ACGT
print(MAX)

Submission status: Wrong Answer

Solution code:
import re
s = input()
m = re.findall(r"([ACGT]+)", s)
print(max(m, key=len) if m else 0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = [str(i) for i in input()]

b = 0
c = 0

for i in range(len(a) - 1):
    if a[i] == 'A' or a[i] == 'C' or a[i] == 'G' or a[i] == 'T':
        b += 1
        if b > c:
            c = b
    else:
        b = 0

print(c)

Submission status: Wrong Answer

Solution code:
s = input()
char_list = ["A","C","G","T"]
temp = 0
now_max = 0

for char in s:
    if char in char_list:
        temp = temp + 1
    else:
        now_max = max(now_max,temp)
        temp = 0

print(now_max)

Submission status: Wrong Answer

Solution code:
S = input()
maxlen = 0
l = 0
for s in S:
    if s in ["A", "T", "G", "C"]:
        l += 0
    else:
        if l > maxlen:
            maxlen = l
            l = 0
if l > maxlen:
    maxlen = l
print(maxlen)

Submission status: Wrong Answer

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

import re

s = input()

result = re.findall(r'[ATGC]+', s)

print(len(max(result)) if result else 0)

Submission status: Wrong Answer

Solution code:
s = str(input())
ans = 0
num = 0
for i in s:
    if i == 'A' or i == 'C' or i == 'G' or i == 'T':
        num += 1
    else :
        ans = max(num,ans)
        num = 0
print(ans)

Submission status: Wrong Answer

Solution code:
s=input()
count = 0
ans = 0
for i in range(len(s)):
    if s[i] != "A" and s[i] != "G" and s[i] != "C" and s[i] != "T":
        ans = max(ans,count)
        count = 0
    else:
        count += 1

print(ans)

Submission status: Wrong Answer

Solution code:
n = input()

tmp = 0
count = 0
for i in n:
    if i == "A" or i == "C" or i == "G" or i == "T":
        count+=1
    else:
        tmp = max(tmp,count)
        count=0
if tmp == 0:
    print(count)
else:
    print(tmp)

Submission status: Wrong Answer

Solution code:
n = input()

tmp = 0
count = 0
for i in n:
    print(i)
    if i == "A" or i == "C" or i == "G" or i == "T":
        count+=1
    else:
        print(tmp,count)
        tmp = max(tmp,count)
        count=0
if tmp == 0:
    print(count)
else:
    print(tmp)

Submission status: Wrong Answer

Solution code:
S = str(input())
atcg = "ATCG"
count = 0
count_max = 0
for x in S:
    if x in atcg:
        count += 1
    else:
        if count_max <= count:
            count_max = count
        count = 0
if count_max == 0:
  count_max = count
print(count_max)

Submission status: Wrong Answer

Solution code:
S = str(input())
atcg = "ATCG"
count = 0
count_max = 0
for x in S:
    if x in atcg:
        count += 1
    else:
        if count_max < count:
            count_max = count
        count = 0
if count_max == 0:
  count_max = count
print(count_max)

Submission status: Wrong Answer

Solution code:
S = str(input())
atcg = "ATCG"
count = 0
count_max = 0
for x in S:
    if x in atcg:
        count += 1
    else:
        if count_max < count:
            count_max = count
        count = 0
print(count_max)

Submission status: Wrong Answer

Solution code:
n = input()

tmp = 0
count = 0
for i in n:
    if i == "A" or i == "C" or i == "G" or i == "T":
        count+=1
    else:
        tmp = max(tmp,count)
        count=0
print(tmp)

Submission status: Wrong Answer

Solution code:
b=input()
max = 0
count = 0

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

print(max)

Submission status: Wrong Answer

Solution code:
a = input()
check = list(a)
head = 0
foot = 0
length = 0
ans = 0
for i in range(0,len(check)):
    if check[i]== "A" or check[i]== "T" or check[i]== "C" or check[i]== "G":
        dum =0
    else:
        check[i]=0
for i in range(0,len(check)):
    for i in reversed(range(foot,len(check))):
        if check[i]!=0:
            head = i
        else:
            dum=0
    for i in reversed(range(head,len(check))):
        if check[i]==0:
            foot = i
        else:
            dum=0
    if foot == 0:
        foot = len(check)
    if head == 0 and check[0]==0:
        head = len(check)
    length = foot - head
    if ans < length:
        ans = length
    else:
        dum=0
print(ans)

Submission status: Wrong Answer

Solution code:
a = input()
check = list(a)
head = 0
foot = 0
length = 0
ans = 0
for i in range(0,len(check)):
    if check[i]== "A" or check[i]== "T" or check[i]== "C" or check[i]== "G":
        dum =0
    else:
        check[i]=0
for i in range(0,len(check)):
    for i in reversed(range(foot,len(check))):
        if check[i]!=0:
            head = i
        else:
            dum=0
    for i in reversed(range(head,len(check))):
        if check[i]==0:
            foot = i
        else:
            dum=0
    if foot == 0:
        foot = len(check)
    length = foot - head
    if ans < length:
        ans = length
    else:
        dum=0
print(ans)

Submission status: Wrong Answer

Solution code:
a = input()
check = list(a)
head = 0
foot = 0
length = 0
ans = 0
for i in range(0,len(check)):
    if check[i]== "A" or check[i]== "T" or check[i]== "C" or check[i]== "G":
        dum =0
    else:
        check[i]=0
for i in range(0,len(check)):
    for i in reversed(range(foot,len(check))):
        if check[i]!=0:
            head = i
        else:
            dum=0
    for i in reversed(range(head,len(check))):
        if check[i]==0:
            foot = i
        else:
            dum=0
    if foot == 0:
        foot = len(check)
    print(head , foot)
    length = foot - head
    if ans < length:
        ans = length
    else:
        dum=0
print(ans)

Submission status: Wrong Answer

Solution code:
a = input()
check = list(a)
head = 0
foot = 0
length = 0
ans = 0
for i in range(0,len(check)):
    if check[i]== "A" or check[i]== "T" or check[i]== "C" or check[i]== "G":
        dum =0
    else:
        check[i]=0
for i in range(0,len(check)):
    for i in reversed(range(foot,len(check))):
        if check[i]!=0:
            head = i
        else:
            dum=0
    for i in reversed(range(head,len(check))):
        if check[i]==0:
            foot = i
        else:
            dum=0
    length = foot - head
    if ans < length:
        ans = length
    else:
        dum=0
print(ans)

Submission status: Wrong Answer

Solution code:
S=str(input())
cnt=0
maxcnt=0
for i in S:
    if(i=="A" or i=="C" or i=="G" or i=="T"):
        cnt+=1
    else:
        if(maxcnt<cnt):
            maxcnt=cnt
        cnt=0
print(maxcnt)

Submission status: Wrong Answer

Solution code:
S = str(input())
counter = 0
max = 0

for i in S:
    if i == 'A' or i == 'T' or i == 'C' or i == 'G':
        counter += 1
        if counter >= max:
            max = counter
    else:
        counter = 0

print(counter)

Submission status: Wrong Answer

Solution code:
s = input()

L = [0]
cnt = 0

for x in s:
    if x == "A" or x == "C" or x == "G" or x == "T":
        cnt += 1
    else:
        L.append(cnt)
        cnt = 0
        
print(max(L))

Submission status: Wrong Answer

Solution code:
s = input()

L = [0]
cnt = 0

for x in s:
    if x == "A" or x == "C" or x == "G" or x == "T":
        cnt += 1
    else:
        L.append(cnt)
        
print(max(L))

Submission status: Wrong Answer

Solution code:
s = input()

L = [0]
cnt = 0

for x in s:
    if x == "A" or x == "C" or x == "G" or x == "T":
        cnt += 1
    else:
        L.append(cnt)
        
max(L)

Submission status: Wrong Answer

Solution code:
str = input()

max = 0
cnt = 0
for i in str:
  if (i == 'A' or i == 'T' or i == 'C' or i == 'G'):
    cnt += 1
  else:
    if (cnt > max):
      max = cnt
    cnt = 0

print(max)

Submission status: Wrong Answer

Solution code:
str = input()

max = 0
cnt = 0
for i in str:
  if (i == 'A' or i == 'T' or i == 'C' or i == 'G'):
    cnt += 1
  else:
    if (cnt >= max):
      max = cnt
    cnt = 0

print(max)

Submission status: Wrong Answer

Solution code:
s = input()
t = [-1]

for i in range(len(s)):
    if s[i] != "A" and s[i] != "G" and s[i] != "C" and s[i] != "T":
        t.append(i)

ans = 0
for j in range(len(t) - 1):
    x = t[j+1] - t[j] - 1
    if x > ans:
        ans = x

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a=input()
k=0
ans=0
for b in a:
    if (b=='A')or(b=='C')or(b=='G')or(b=='T'):
        k=k+1
    
    else:
        if ans<k:
            ans=k
        k=0
print(ans)

Submission status: Wrong Answer

Solution code:
S = (input())
k=0
j=0
for  chr in S:
    if chr in ['A','C','G','T']:
        j=j+1
    else:
        if k<j:
            k=j
        j=0
print(k)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()

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

print(max_count)

Submission status: Wrong Answer

Solution code:
s = input()

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

print(max_count)

Submission status: Wrong Answer

Solution code:
s = input()
list0 = ['A', 'C', 'G', 'T']
list1 = [0]
flag = 0
for i in s:
  if i in list0:
    flag += 1
  else:
    if flag != 0:
      list1.append(flag)
    flag *= 0
print(max(list1))

Submission status: Wrong Answer

Solution code:
s = input()
list0 = ['A', 'C', 'G', 'T']
list1 = [0]
frag = 0
for i in s:
  if i in list0:
    frag += 1
  else:
    if frag != 0:
      list1.append(frag)
    frag = 0
print(max(list1))

Submission status: Wrong Answer

Solution code:
s = list(input())
for i in range(len(s)):
  if s[i] == 'A' or s[i] == 'T' or s[i] == 'C' or s[i] == 'G':
    s[i] = 'X'
count = 0
X_count = 0
for i in range(len(s) - 1):
  if s[i] == 'X' and s[i+1] == 'X':
    count += 1
  if s[i] == 'X':
    X_count += 1
if count == 0 and X_count == 0:
  print(0)
elif count == 0 and X_count > 0:
  print(1)
else:
  print(count+1)

Submission status: Wrong Answer

Solution code:
s = list(input())
for i in range(len(s)):
  if s[i] == 'A' or s[i] == 'T' or s[i] == 'C' or s[i] == 'G':
    s[i] = 'X'
count = 0
X_count = 0
for i in range(len(s) - 1):
  if s[i] == 'X' and s[i+1] == 'X':
    count += 1
  if s[i] == 'X':
    X_count += 1
if count == 0 and X_count == 0:
  print(count)
else:
  print(count + 1)

Submission status: Wrong Answer

Solution code:
s = list(input())
for i in range(len(s)):
  if s[i] == 'A' or s[i] == 'T' or s[i] == 'C' or s[i] == 'G':
    s[i] = 'X'
count = 0
for i in range(len(s) - 1):
  if s[i] == 'X' and s[i+1] == 'X':
    count += 1
if count == 0:
  print(count)
else:
  print(count + 1)

Submission status: Wrong Answer

Solution code:
s = list(input())
for i in range(len(s)):
  if s[i] == 'A' or s[i] == 'T' or s[i] == 'C' or s[i] == 'G':
    s[i] = 'X'
count = 1
for i in range(len(s) - 1):
  if s[i] == 'X' and s[i+1] == 'X':
    count += 1
print(count)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python
# -*- Coding: utf-8 -*-

def main():
    sample = raw_input()
    arr = []
    length = 0
    ans = 0
    for s in sample:
        arr.append(s)
    for t in arr:
        if t == 'A' or t == 'C' or t == 'G' or t == 'T':
            length += 1
    if ans < length:
        ans = length
        length = 0
    return ans

print(main())

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python
# -*- Coding: utf-8 -*-

def main():
    sample = raw_input()
    arr = []
    length = 0
    ans = 0
    for s in sample:
        arr.append(s)
    for t in arr:
        if t == 'A' or t == 'C' or t == 'G' or t == 'T':
            length += 1
        else:
            if ans < length:
                ans = length
                length = 0
    return ans

print(main())

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python
# -*- Coding: utf-8 -*-

def main():
    sample = raw_input()
    arr = []
    length = 0
    ans = 0
    for s in sample:
        arr.append(s)
    for t in arr:
        if t == 'A' or t == 'C' or t == 'G' or t == 'T':
            length += 1
        elif ans < length or ans == length:
            ans = length
            length = 0
    return ans

print(main())

Submission status: Wrong Answer

Solution code:
ref=input()

count=0
seq=["A","T","G","C"]
for base in seq:
    if base in ref:
        count +=1
    else:
         count =0

print(count)

Submission status: Wrong Answer

Solution code:
ref=input()

count=0
seq=["A","T","G,","C"]
for base in seq:
    if base in ref:
        count +=1
    else:
         count =0

print(count)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python
# -*- Coding: utf-8 -*-
 
sample = ''
sample = str(raw_input())
def main(sample):
    arr = []
    length = 0
    ans = 0
    for s in sample:
        arr.append(s)
    for t in arr:
        if t == 'A' or t == 'C' or t == 'G' or t == 'T':
            length += 1
        elif ans < length:
            ans = length
    print(ans)
 
main(sample)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python
# -*- Coding: utf-8 -*-

sample = ''
sample = str(raw_input())
def main(sample):
    arr = []
    length = 0
    ans = 0
    for s in sample:
        arr.append(s)
    for t in arr:
        if t == 'A' or t == 'C' or t == 'G' or t == 'T':
            length += 1
        elif ans < length:
            ans = length
    print(ans)
    return True

main(sample)

Submission status: Wrong Answer

Solution code:
a = list(input())
b = ""
c = ""
for i in range(len(a)):
  if(a[i] == "A" or a[i] == "G" or a[i] == "T" or a[i] == "C"):
    b += a[i]
  else:
    if(len(b)>=len(c)):
      c = b
    b = ""
print(len(c))

Submission status: Wrong Answer

Solution code:
a = list(input())
b = ""
c = ""
for i in range(len(a)):
  if(a[i] == "A" or a[i] == "G" or a[i] == "T" or a[i] == "C"):
    b += a[i]
  else:
    if(len(b)>len(c)):
      c = b
    b = ""
print(len(c))

Submission status: Wrong Answer

Solution code:
a = list(input())
b = ""
c = ""
for i in range(len(a)):
  if(a[i] == "A" or a[i] == "G" or a[i] == "T" or a[i] == "C"):
    b += a[i]
  else:
    if(len(b)>len(c)):
      c = b
      b = ""
print(len(c))

Submission status: Wrong Answer

Solution code:
a = list(input())
b = ""
c = ""
for i in range(len(a)):
  if(a[i] == "A" or a[i] == "G" or a[i] == "T" or a[i] == "C"):
    b += a[i]
  else:
    if(len(b)>len(c)):
      c = b
      b = ""
print(c)

Submission status: Wrong Answer

Solution code:
import sys

arg = input()
scavenger=''
warehouse=[]
longest=0
i=0

for tmp in arg[0:]:
  if tmp=='A' or tmp=='T' or tmp=='C' or tmp=='G':
    scavenger=scavenger+tmp
  else:
    warehouse.append(scavenger)
    scavenger=''

for tmp in warehouse[0:]:
  if len(tmp)>longest:
    longest=len(tmp)

print(longest)

Submission status: Wrong Answer

Solution code:
import sys

arg = input()
scavenger=''
warehouse=[]
longest=0
i=0

for tmp in arg[0:]:
  if tmp=='A':
    scavenger=scavenger+tmp
  elif tmp=='T':
    scavenger=scavenger+tmp
  elif tmp=='C':
    scavenger=scavenger+tmp
  elif tmp=='G':
    scavenger=scavenger+tmp
  else:
      warehouse.append(scavenger)


for tmp in warehouse[0:]:
  if len(tmp)>longest:
    longest=len(tmp)

print(longest)

Submission status: Wrong Answer

Solution code:
S = str(input())
max = -1
for i in range(len(S)):
    k = 1
    if not(S[i] in {'A','T','G','C'}):
        continue
    for j in range(i+1,len(S)):
       if S[j] in {'A','T','G','C'}:
           k+=1
       else:
           break

    if k > max:
        max = k

print(max)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S="AFA"
ans=0
cnt=0
for s in S:
    if s in "A":
        cnt+=1
    elif s in "C":
        cnt+=1
    elif s in "G":
        cnt+=1
    elif s in "T":
        cnt+=1   
    else:
        cnt=0
    ans=max(ans,cnt)
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
count = 0
longest = 0
for l in S:
    if l in ['A', 'C', 'G', 'T']:
        count += 1
    else:
        if count > longest:
            longest = count
        count = 0

print(longest)

Submission status: Wrong Answer

Solution code:
s=str(input())
ans=0
cnt=0
for i in s:
    if (i == 'A') or (i == 'C') or (i == 'G') or (i == 'T'):
        cnt+=1
    else:
        ans=max(ans,cnt)
        cnt=0
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
maxnum = 0
c = 0
for i in s:
  if i in "ACGT":
    c += 1
  else:
    maxnum = max(maxnum, c)
    c=0
print(maxnum)

Submission status: Wrong Answer

Solution code:
l = list(input())

count = 0
tmp = 0

for i in range(len(l)):
    if l[i] in "ATGC":
        tmp += 1
        count = count+1 if tmp == count+1 else count
    else: tmp = 0

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
ls = [ "B", "D", "E", "F", "H", "I", "J", "K", "L", "M", "N",
      "O", "P", "Q", "R", "S", "U", "V", "W", "X", "Y", "Z" ]
literal = input().upper()
for alp in ls:
  literal = literal.replace(alp, "_")
  spl = literal.split('_')
  print(max([len(x) for x in spl]))

Submission status: Wrong Answer

Solution code:
ls = [ "B", "D", "E", "F", "H", "I", "J", "K", "L", "M", "N",
        "O", "P", "Q", "R", "S", "U", "V", "W", "X", "Y", "Z" ]
literal = input()
if literal == "":
    print("0")
else:
    for alp in ls:
        literal = literal.replace(alp, "_")
    spl = literal.split('_')
    spl = sorted(spl, reverse = True)
    print(len(spl[0]))

Submission status: Wrong Answer

Solution code:
ls = [ "B", "D", "E", "F", "H", "I", "J", "K", "L", "M", "N",
        "O", "P", "Q", "R", "S", "U", "V", "W", "X", "Y", "Z" ]
literal = input()
for alp in ls:
    literal = literal.replace(alp, "_")

spl = literal.split('_')
spl = sorted(spl, reverse = True)
print(len(spl[0]))

Submission status: Wrong Answer

Solution code:
S = input()
ACGT = ['A', 'C', 'G', 'T']
ans = []
if len(S) == 1:
    if S in ACGT:
        print(1)
    else:
        print(0)
else:
    for i in range(len(S)):
        j = 0
        while i + j < len(S):
            if S[i + j] in ACGT:
                j += 1
            else:
                ans.append(S[i : i + j])
                break
        if i + j == len(S):
            ans.append(S)
    
    print(max([len(x) for x in ans]))

Submission status: Wrong Answer

Solution code:
S = str(input())
listS = list(S)

count = 0
max = 0

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

print(max)

Submission status: Wrong Answer

Solution code:
S = str(input())
listS = list(S)

count = 0
max = 0

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

print(max)

Submission status: Wrong Answer

Solution code:
S = str(input())
listS = list(S)

count = 0
max = 0

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

print(max)

Submission status: Wrong Answer

Solution code:
input=input()
count=0
max=0
for c in input:
    if c is 'A' or c is 'C' or c is 'G' or c is 'T':
        count+=1
    else:
        if max < count:
            max = count
        count=0

print (max)

Submission status: Wrong Answer

Solution code:
x=input()

X=[]

for i in range(len(x)):
    if x[i]=="A":
        X.append(x[i])
    elif x[i]=="T":
        X.append(x[i])
    elif x[i]=="C":
        X.append(x[i])
    elif x[i]=="G":
        X.append(x[i])



print("".join(X))

Submission status: Wrong Answer

Solution code:
import re
S = input()
print(len(re.search(r'(A|T|C|G)*',S).group()))

Submission status: Wrong Answer

Solution code:
import re
S = input()
re.search(r'(A|T|C|G)*',S)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
str_S = raw_input()

list_S = list(str_S)
list = list(str_S)

list_number = []

while list != []:
    number = 0
    for char in list:
        if char == 'A' or char == 'C' or char == 'G' or char == 'T':
            number += 1
        else:
            break
    list_number.append(number)

    for n in range(number + 1):
        if list != []:
            list.pop(0)

print list_number

Submission status: Wrong Answer

Solution code:
s = list(input())

longest = 0
current = 0
for c in s:
	if c in set("ATCG"):
		current += 1
	else:
		longest = max([current, longest])
		current = 0

print(longest)

Submission status: Wrong Answer

Solution code:
moji = 'ACGT'

s = input()
part = ''
lenMax = 0

for i in range(len(s)):
    if s[i] in moji:
        part += s[i]
    else:
        length = len(part)
        if length > lenMax:
            lenMax = length
        part = ''
        
print(lenMax)

Submission status: Wrong Answer

Solution code:
S = input()
maxlength = 0
length = 0
for i in S:
  if i in 'ATGC':
    length += 1
  else:
    length =0
  maxlength = max(maxlength, length)

Submission status: Wrong Answer

Solution code:
S = list(input())
cnt = 0
l = [i for i,s in enumerate(S) if s in ["A", "T", "G", "C"]]
for j in range(len(l)):
    if not l[j-1]+1 == l[j]:continue
    else:
        if cnt == 0:cnt = 1
        cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
s = input()
candidate = 0


def length(s, i, j):
    for c in s[i:j + 1]:
        if c not in 'ACGT':
            return 0
    return len(s[i:j])


for i in range(len(s)):
    for j in range(len(s)):
        candidate = max(candidate, length(s, i, j))

print(candidate)

Submission status: Wrong Answer

Solution code:
s = input()
candidate = 0


def length(s, i, j):
    for c in s[i:j]:
        if c not in 'ACGT':
            return 0
    return len(s[i:j])


for i in range(len(s)):
    for j in range(len(s)):
        candidate = max(candidate, length(s, i, j))

print(candidate)