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

T = ["A", "C", "G", "T"]
max_length = 0

for start in range(len(S)):
    for end in reversed(range(len(S))):
        checked = False
        if start > end:
            break
        else:
            sub_str = S[start:end]
            check_str = (
                sub_str.replace("A", "")
                .replace("C", "")
                .replace("G", "")
                .replace("T", "")
            )

            if len(check_str) != 0:
                checked = True
            else:
                if max_length < len(sub_str):
                    max_length = len(sub_str)

print(max_length)

Submission status: Wrong Answer

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

length = 0
for target in s:
	if target in acgt:
		length += 1
	else:
		if max_length < length:
			max_length = length
		length = 0

print(max_length)

Submission status: Wrong Answer

Solution code:
S = input();
answer_max=0;
answer=0;

for i in S:
    if(i=="A" or i=="C" or i=="G" or i=="T"):
        answer+=1;
    else:
        if(answer_max < answer):
            answer_max = answer;
        answer=0;

print(answer_max);

Submission status: Wrong Answer

Solution code:
tmp = input()

char_list = list()
acgt_list = list()
max_acgt = list()
acgt = ["A", "C", "G", "T"]
for char in tmp:
  if char in acgt:
    acgt_list.append(char)
    if len(max_acgt) < len(acgt_list):
      max_acgt = acgt_list
  else:
    if len(max_acgt) < len(acgt_list):
      max_acgt = acgt_list
      acgt_list = list()
print(len(max_acgt))

Submission status: Wrong Answer

Solution code:
""" AtCoder """

S = input()

ans = 0
ans_max = 0
l = ['A', 'C', 'G', 'T']
check = 1

for i in S:
    if i in l:
        ans += 1
    else:
        ans_max = max(ans_max, ans)
        ans = 0
        check = 0

if check == 1:
    ans_max = len(S)

print(ans_max)

Submission status: Wrong Answer

Solution code:
x=input()
count=0
flag=0
countList=[]
for i in range(len(x)):
    if x[i]=='A' or x[i]=='T' or x[i]=='C' or x[i]=='G':
        if flag==0:
            flag=1

        count=count+1
    else:
        if flag==1:
            countList=countList+[count]
        count=0
        flag=0

if countList==[]:
    print('0')
else:
    print(str(max(countList)))

Submission status: Wrong Answer

Solution code:
def is_ATCG(str):
    for i in range(len(str)):
        chr=str[i]
        if(not(chr=='A' or chr=='T' or chr == 'C' or chr=='G')):
            return 0
    return 1

i_str=input()
max_len=0
len_str=len(i_str)

for i in range(len_str): #０行目から最後の行まで
    for j in range(i,len_str): #それぞれの文字数目から行末までのそれぞれの部分単語を取り出す
        strA=i_str[i:j+1:1]
        if max_len < len(strA) and is_ATCG(strA):
            max_len = len(strA)
        print(strA + ' ' +str(max_len))
print(max_len)

Submission status: Wrong Answer

Solution code:
S = list(input())

b = 0

ans = [0]

for i in S:
  if (i == 'A' or i == 'G' or i == 'C' or i == 'T'):
    b += 1
  else:
    ans.append(b)
    b = 0
print(max(ans))

Submission status: Wrong Answer

Solution code:
import re

data = input().upper()

text = re.sub('[ACGT]+', "", data)

print(len(text))

Submission status: Wrong Answer

Solution code:
S = input()

T = ["A", "C", "G", "T"]
max_length = 0

for start in range(len(S)):
    checked = False
    for end in reversed(range(len(S))):
        if start > end:
            break
        else:
            sub_str = S[start:end]
            if len(sub_str) == 0:
                break
            else:
                check_str = (
                    sub_str.replace("A", "")
                    .replace("C", "")
                    .replace("G", "")
                    .replace("T", "")
                )
                if len(check_str) != 0:
                    checked = True
                else:
                    if max_length < len(sub_str):
                        max_length = len(sub_str)

print(max_length)

Submission status: Wrong Answer

Solution code:
S = input();
answer=0;

for i in S:
    if(i=="A" or i=="C" or i=="G" or i=="T"):
        answer+=1;

print(answer);

Submission status: Wrong Answer

Solution code:
S = input()
L=len(S)
longest=0
for i in range(L):
  for j in range(i+1):
    DUP=S[j:i]
    DUP=DUP.replace("A","#")
    DUP=DUP.replace("T","#")
    DUP=DUP.replace("G","#")
    DUP=DUP.replace("C","#")
    count=0
    for a in range(len(DUP)):
      if DUP[a]=="#":
        count+=1
      else:
        break
    else:
      longest=max(longest,count)
print(longest)

Submission status: Wrong Answer

Solution code:
S = input()

b = 0

ans = [0]

s = list(S)

for i in s:
  if (i == 'A' or i == 'G' or i == 'C' or i == 'T'):
    b += 1
  else:
    ans.append(b)
    b = 0
print(max(ans))

Submission status: Wrong Answer

Solution code:
S = input()
count = 0
max_count = 0
for s_char in S:
    if s_char == 'A' or s_char == 'C' or s_char == 'G' or s_char == 'T':
        count += 1
    else:
        max_count = max(max_count, count)
        count = 0
print(max_count)

Submission status: Wrong Answer

Solution code:
S = input()
acgt = ["A","C","G","T"]
S_tf = [any([sss == aaa for aaa in acgt]) for sss in S]
print(S_tf)
maxlen = 0
curlen = 0
for i in S_tf:
    if i:
        curlen += 1
        if maxlen < curlen:
            maxlen = curlen
    else:
        curlen = 0
print(maxlen)

Submission status: Wrong Answer

Solution code:
tmp = input()

char_list = list()
acgt_list = list()
max_acgt = list()
acgt = ["A", "C", "G", "T"]
for char in tmp:
  if char in acgt:
    acgt_list.append(char)
  	
  else:
    if len(max_acgt) < len(acgt_list):
      max_acgt = acgt_list
      acgt_list = list()
print(len(max_acgt))

Submission status: Wrong Answer

Solution code:
def long(a):
    if a.find('A')<0 and a.find('C')<0 and a.find('G')<0 and a.find('T')<0:
        k = -1
    else:
        k = 0
    for i in range(len(a)-1):
        if a[i] in ['A','C','G','T'] and a[i+1] in ['A','C','G','T']:
            k = k+1
       
    return k+1
                            
a =input()
print(long(a))

Submission status: Wrong Answer

Solution code:
cnt = 0
rslt = 0


for a in "HATAGAYA":
    flg = 0
    for b in "ATGC":
        if a == b:
            cnt = cnt + 1
            flg = 1
            break
            
    print(a + " :" + str(cnt))
    
    if rslt <= cnt:
        rslt = cnt
        
    if flg == 0:
        cnt = 0


print(rslt)

Submission status: Wrong Answer

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

cnt = 0
maxCnt = 0
for s in S:
  if s in arr:
    cnt += 1
  else:
    if maxCnt < cnt:
      maxCnt = cnt
    cnt = 0
if maxCnt == 0:
  maxCnt = cnt
print(maxCnt)

Submission status: Wrong Answer

Solution code:
import re
S = input()
L = len(S)
mlen = 0

def acgt(s):
    tmp = list(s)
    cnt = 0
    for t in tmp:
        if t in ['A', 'G', 'C', 'T']:
            cnt += 1
    return cnt == len(s)

for i in range(L):
    for j in range(L):
        tmp = re.sub(S[-i:] + '$', '', S)
        tmp = re.sub('^' + S[:j], '', tmp)
        if acgt(tmp) and len(tmp) > mlen:
            mlen = len(tmp)
print(mlen)

Submission status: Wrong Answer

Solution code:
s = list(input())
t = [s.index(i) for i in s if i not in ["A","T","G","C"]]
if len(t) == 0:
	print(len(s))
else:
	t = t + [len(s)+1]
	u = 0
	w = -1
	for i in range(len(t)-1):
		if u <= t[i]-w:
			u = t[i]-w
		w = t[i]
	print(u-1)

Submission status: Wrong Answer

Solution code:
S = input()
l= len(S)
ans = 0

for i in range(l):
    for j in range(l-i):
        seq = S[i:i+j]
        seq2 = seq.replace("A","").replace("G","").replace("T","").replace("C","")
        if seq2 == "":
            ans = max(ans, len(seq))

print(ans)

Submission status: Wrong Answer

Solution code:
import re
S = input()
L = len(S)
mlen = 0

def acgt(s):
    tmp = list(s)
    cnt = 0
    for t in tmp:
        if t in ['A', 'G', 'C', 'T']:
            cnt += 1
    return cnt == len(s)

for i in range(L):
    for j in range(L):
        tmp = re.sub(S[-i:] + '$', '', S)
        tmp = re.sub('^' + S[:j], '', tmp)
        tmp = S.rstrip(S[-i:]).lstrip(S[:j])
        if acgt(tmp) and len(tmp) > mlen:
            mlen = len(tmp)
print(mlen)

Submission status: Wrong Answer

Solution code:
S = input()
list = ['A', 'C', 'G', 'T']
answer = 0
current = 0
for i in range(len(S)):
    if S[i] not in list:
        if answer < current:
            answer = current
        current = 0
    elif S[i] in list:
        current += 1
if current == len(S):
    answer = current
print(answer)

Submission status: Wrong Answer

Solution code:
s = input()
def check(substr):
    ret = 0
    for i in range(len(substr)):
        if substr[i] !='A' and substr[i] !='C' and substr[i] != 'G' and substr[i] !='T':
            return 0
        else:
            ret +=1
    return ret
ans = 0
for i in range(len(s)):
    for j in range(i,len(s)):
        sub = s[i:j]
        ans = max(ans, check(sub))
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
list_atgc = ["A", "C", "G", "T"]
demand_list = []
for i in range(len(S)):
    if S[i] in list_atgc:
        j = 0
        while True:
            if S[i+j] in list_atgc:
                demand_list.append(S[i:j+1])
                j += 1
                if i + j >= len(S):
                    break
            else:
                break
if demand_list:
    print(len(max(demand_list, key=len)))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
s = input()
s2 = ''
for c in s:
    if c in ('A','T','C','G'):
        s2 += '1'
    else:
        s2 += '0'

tmp = 0
ret = 0
for c in s2:
    if c == '1':
        tmp += 1
    else:
        ret = max(ret, tmp)
        tmp = 0
ret = max(ret, tmp)
print(tmp)

Submission status: Wrong Answer

Solution code:
S = input()
L=len(S)
longest=0
for i in range(L):
  for j in range(i):
    DUP=S[j:i+1]
    DUP=DUP.replace("A","#")
    DUP=DUP.replace("T","#")
    DUP=DUP.replace("G","#")
    DUP=DUP.replace("C","#")
    count=0
    for a in range(len(DUP)):
      if DUP[a]=="#":
        count+=1
      else:
        break
    else:
      longest=max(longest,count)
print(longest)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
# ----------------------------------------------------------------
# Use Solve Function

def solve(lines):
    S = lines.pop(0)
    c = 0
    res = 0
    for i in S:
        if i in 'AGCT':
            c += 1
        else:
            res = max(res, c)
            c = 0
    print(res)

lines = [x.strip() for x in sys.stdin.readlines()]

#
# solve !!
#
solve(lines)

Submission status: Wrong Answer

Solution code:
def longest_acgt(t):
    helix = ["A","C","G","T"]
    length = 0
    max_length = 0
    for c in t:
        if c in helix:
            length += 1
        else:
            if max_length < length:
                max_length = length
                length = 0
    return max_length

t = input()
print(longest_acgt(t))

Submission status: Wrong Answer

Solution code:
S = input()
countermax = 0
counter = 0
for s in S:
    if s == 'A' or s == 'C' or s == 'G' or s == 'T':
        counter += 1
    else:
        if countermax < counter:
            countermax = counter
            counter = 0

print(countermax)

Submission status: Wrong Answer

Solution code:
s = input()
s2 = ''
for c in s:
    if c in ('A','T','C','G'):
        s2 += '1'
    else:
        s2 += '0'

tmp = 0
ret = 0
for c in s2:
    if c == '1':
        tmp += 1
    else:
        tmp = 0
        ret = max(ret, tmp)
ret = max(ret, tmp)
print(tmp)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
# ----------------------------------------------------------------
# Use Solve Function

def solve(lines):
    S = lines.pop(0)
    c = 0
    res = 0
    for i in S:
        if i in 'AGCT':
            c += 1
        else:
            res = max(res, c)
            c = 0
    print(res)

lines = [x.strip() for x in sys.stdin.readlines()]

Submission status: Wrong Answer

Solution code:
def tasu(i):
    global bubun
    if i >= len(string):
        return
    elif string[i] == "A" or string[i] == "C" or string[i] == "G" or string[i] == "T":
        bubun += string[i]
        tasu(i + 1)

string = input()

lst = [""]

for i in range(len(string)):
    if string[i] == "A" or string[i] == "C" or string[i] == "G" or string[i] == "T":
        bubun = ""
        tasu(i)
        lst.append(bubun)

print(len(max(lst)))

Submission status: Wrong Answer

Solution code:
s = str(input())


s1 = s.replace("A","1")
s2 = s1.replace("G","1")
s3 = s2.replace("T","1")
s4 = s3.replace("C","1")

if s4.count("1111111111") == 1:
 print(10)
elif s4.count("111111111") == 1:
 print(9)
elif s4.count("11111111") == 1:
 print(8)
elif s4.count("1111111") == 1:
 print(7)
elif s4.count("111111") == 1:
 print(6)
elif s4.count("11111") == 1:
 print(5)
elif s4.count("1111") == 1:
 print(4)
elif s4.count("111") == 1:
 print(3)
elif s4.count("11") == 1:
 print(2)
elif s4.count("1") == 1:
 print(1)
else:
 print(0)

Submission status: Wrong Answer

Solution code:
S = input()
max_len = 0
for i in range(len(S)):
    for j in range(i+1, len(S)):
        s = S[i:j]
        s = s.replace('A', '.')
        s = s.replace('T', '.')
        s = s.replace('G', '.')
        s = s.replace('C', '.')
        flag = True
        for ss in s:
            if ss != '.':
                flag = False
        if flag:
            if max_len < len(s):
                max_len = len(s)
print(max_len)

Submission status: Wrong Answer

Solution code:
cnt = 0
rslt = 0
for a in "HATAGAYA":
    for b in "ATGC":
        if a == b:
            cnt = cnt + 1
            break
        elif b == "C":
            cnt = 0
    
    if rslt <= cnt:
        rslt = cnt


print(rslt)

Submission status: Wrong Answer

Solution code:
s = input()
s2 = ''
for c in s:
    if c in ('A','T','C','G'):
        s2 += '1'
    else:
        s2 += '0'

tmp = 0
ret = 0
for c in s2:
    if c == '1':
        tmp += 1
    else:
        ret = max(ret, tmp)
ret = max(ret, tmp)
print(tmp)

Submission status: Wrong Answer

Solution code:
def tasu(i):
    global bubun
    if i >= len(string):
        return
    elif string[i] == "A" or string[i] == "C" or string[i] == "G" or string[i] == "T":
        bubun += string[i]
        tasu(i + 1)

string = input()

lst = [""]

for i in range(len(string)):
    if string[i] == "A" or string[i] == "C" or string[i] == "G" or string[i] == "T":
        bubun = ""
        tasu(i)
        lst.append(bubun)

print(len(max(lst)))
print(lst)
print(max(lst))

Submission status: Wrong Answer

Solution code:
s = input()
s2 = ''
for c in s:
    if c in ('A','T','C','G'):
        s2 += '1'
    else:
        s2 += '0'

print(s,s2)

tmp = 0
ret = 0
for c in s2:
    if c == '1':
        tmp += 1
    else:
        ret = max(ret, tmp)
ret = max(ret, tmp)
print(tmp)

Submission status: Wrong Answer

Solution code:
S = input()
L=len(S)
longest=0
for i in range(L):
  for j in range(i):
    DUP=S[j:i+1]
    DUP=DUP.replace("A","#")
    DUP=DUP.replace("T","#")
    DUP=DUP.replace("G","#")
    DUP=DUP.replace("C","#")
    count=0
    for a in range(len(DUP)):
      if DUP[a]=="#":
        count+=1
      else:
        break
    else:
      longest=max(longest,count+1)
print(longest)

Submission status: Wrong Answer

Solution code:
S = input()
max_len = 0
for i in range(len(S)):
    for j in range(i+1, len(S)):
        s = S[i:j]
        s = s.replace('A', '.')
        s = s.replace('T', '.')
        s = s.replace('G', '.')
        s = s.replace('C', '.')
        flag = True
        for ss in s:
            if ss != '.':
                flag = False
                print(s)
        if flag:
            if max_len < len(s):
                max_len = len(s)
print(max_len)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
# ----------------------------------------------------------------
# Use Solve Function

def solve(lines):
    S = lines.pop(0)
    c = 0
    res = 0
    for i in S:
        if i in 'AGCT':
            c += 1
        else:
            res = max(res, c)
    print(res)

lines = [x.strip() for x in sys.stdin.readlines()]

#
# solve !!
#
solve(lines)

Submission status: Wrong Answer

Solution code:
S = input()
list = ['A', 'C', 'G', 'T']
answer = 0
current = 0
for i in range(len(S)):
    if S[i] not in list:
        if answer < current:
            answer = current
        current = 0
    else:
        current += 1
if current == len(S):
    answer = current
print(answer)

Submission status: Wrong Answer

Solution code:
s = list(input())
t = [s.index(i) for i in s if i not in ["A","T","G","C"]]
t = t + [len(s)+1]
u = 0
w = -1
for i in range(len(t)-1):
    if u <= t[i]-w:
        u = t[i]-w
    w = t[i]
print(u-1)

Submission status: Wrong Answer

Solution code:
b = input()
let = 'ATGC'
prev = b[0]
high = 0
leng = 0
stop = False
if prev in let:
    leng = 1
    high = 1
for i in range(1,len(b)):
    if leng == 0 and b[i] in let:
        leng = 1
    if b[i] in let and prev in let:
        leng += 1
        stop = False
    else:
        stop = True
        if leng > high:
            high = leng
            leng = 0
    prev = b[i]
if not stop:
    high = leng
print(high)

Submission status: Wrong Answer

Solution code:
S = list(input())
m = 0
count = 0
for i in range(len(S)):
    for j in range(i, len(S)):
        count = 0
        switch = False
        for s in list(S[i:j+1]):
            if s in ['A', 'G', 'T', 'C'] and switch == False:
                count += 1
            else:
                if m <= count:
                    m = count
                count = 0
                switch = True
                break

print(m)

Submission status: Wrong Answer

Solution code:
s = input()
s2 = ''
for c in s:
    if c in ('A','T','C','G'):
        s2 += '1'
    else:
        s2 += '0'

tmp = 0
ret = 0
for c in s2:
    if c == '1':
        tmp += 1
    else:
        ret = max(ret, tmp)
print(tmp)

Submission status: Wrong Answer

Solution code:
S=list(input())
Check_list=['A','T','G','C']
 
out_num=0
for i in range(len(S)):
  c=[x for x in S[i:] if x not in Check_list]
  if (len(c) == 0) & (len(c) >= out_num):
    out_num=len(S[i:])
  
  for l in range(len(S)): 
    c=[x for x in S[i:-l] if x not in Check_list]
    
    if (len(c) == 0) & (len(c) >= out_num):
      out_num=len(S[i:-l])
       
print(out_num)

Submission status: Wrong Answer

Solution code:
tmp = input()

char_list = list()
acgt_list = list()
max_acgt = list()
acgt = ["A", "C", "G", "T"]
for char in tmp:
  if char in acgt:
    acgt_list.append(char)
    if len(max_acgt) < len(acgt_list):
      max_acgt = acgt_list
  else:
    break
print(len(max_acgt))

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:
    MAX = ACGT
    ACGT = 0
    flag = 1
if flag ==0:
  MAX=ACGT
print(MAX)

Submission status: Wrong Answer

Solution code:
S = input()

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

res = 0

for i in range(len(S)+1):
    for j in range(1,len(S)+1):
        flag = True
        if -j-1 == 0:
            for k in S[i:]:
                if k not in st:
                    flag = False
                    break
        
            if flag:
                res = max(res,len(S[i:]))
        
        else:
            for k in S[i:-j-1]:
                if k not in st:
                    flag = False
                    break
            
            if flag:
                res = max(res,len(S[i:-j-1]))

print(res)

Submission status: Wrong Answer

Solution code:
def main():
    s = input()
    n = len(s)
    output = [0]

    ss = s.replace("A", "s").replace("T", "s").replace("G", "s").replace("C", "s")

    for i in range(n):
        if "s" * i in ss:
            output.append(i)

    print(max(output))
    return 0


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
b = input()
let = 'ATGC'
prev = b[0]
high = 0
leng = 0
stop = False
if prev in let:
    leng = 1
    high = 1
for i in range(1,len(b)):
    if leng == 0 and b[i] in let:
        leng = 1
    if b[i] in let and prev in let:
        leng += 1
    else:
        stop = True
        if leng > high:
            high = leng
            leng = 0
    prev = b[i]
if not stop:
    high = leng
print(high)

Submission status: Wrong Answer

Solution code:
sss = str(input())
ss_list = []

for i in range(len(sss)):
    for j in range(i,len(sss)):
        ss_list.append(sss[i:j])

#文字列を渡して、AGTCから構成されていればその長さを返す
def bh(ss):
    flag = 0
    for s in ss:
        if s not in ["A","G","T","C"]:
            flag = 1
    if flag == 0:
        return len(ss)
    else:
        return 0

max_len = 0
for ss in ss_list:
    l = bh(ss)
    if l>max_len:
        max_len = l

print(max_len)

Submission status: Wrong Answer

Solution code:
s = input()
count,ans = 0,0

for i in s:
  if i =='A' or i == 'T' or i == 'C' or i == 'G':
    
    count+=1
  else:
    ans = max(ans,count)
    count=0
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#coding: utf-8
S = list(input())
enki = ["A", "T", "G", "C"]
a = []
ans = ""
for i in range(len(S)):
    if S[i] == enki[0] or S[i] == enki[1] or S[i] == enki[2] or S[i] == enki[3]:
        ans += S[i]
    else:
        ans = ""
    a.append(ans)
print(len(max(a)))

Submission status: Wrong Answer

Solution code:
def main():
    s = input()
    n = len(s)
    output = [0]

    ss = s.replace("A", "s").replace("T", "s").replace("G", "s").replace("C", "s")

    for i in range(n):
        if "s" * i in ss:
            output.append(i)

    print(max(output))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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


if index:#一致しない文字列が存在
    diff = [index[0]]
    for j in range(len(index)-1):
        diff.append(index[j+1] - index[j] - 1)
    print(max(diff))
    
else:#一致しない文字列が存在しない
    print(len(S))

Submission status: Wrong Answer

Solution code:
b = input()
let = 'ATGC'
prev = b[0]
high = 0
leng = 0

if prev in let:
    leng = 1
    high = 1
for i in range(1,len(b)):
    if leng == 0 and b[i] in let:
        leng = 1
    if b[i] in let and prev in let:
        leng += 1
    else:
        if leng > high:
            high = leng
            leng = 0
    prev = b[i]

print(high)

Submission status: Wrong Answer

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

s = input()


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

Submission status: Wrong Answer

Solution code:
S = input()
#ATCG = 'ATCG'                   
count = 0
j=0
num=[]
for i in range(len(S)):
    # for j in range(4):
    #     if S[i]==ATCG[j]:
    if (S[i] == 'A' or S[i]=='T' or S[i]=='C' or S[i]== 'G') and (i==(len(S)-1)):
        count =count+1
        #print(S[i])
        num.append(count)

    elif S[i] == 'A' or S[i]=='T' or S[i]=='C' or S[i]== 'G':
        count=count+1
        #print(S[i])
       
    else:
        num.append(count)
        j=j+1



max_num=max(num)
print(max_num)

Submission status: Wrong Answer

Solution code:
seq = input()
index = []
for char in list(seq):
    if char == "A" or char == "T" or char == "C" or char == "C":
        index.append("1")
    else:
        index.append("0")
index2 = ''.join(index)
print(len(max(index2.split("0"))))

Submission status: Wrong Answer

Solution code:
def main():
    s = input()
    n = len(s)
    output = 0

    ss = s.replace("A", "s").replace("T", "s").replace("G", "s").replace("C", "s")

    for i in range(n):
        if "s" * i in ss:
            output = i

    print(output)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
b = str(input())
count = 0
max_num = 0
for i in range(len(b)):
    if (b[i] == 'A' or b[i] == 'C' or b[i] == 'G' or b[i] == 'T'):
        count += 1
    else:
        if max_num <= count:
            max_num = count
        count = 0
print(max_num)

Submission status: Wrong Answer

Solution code:
S = list(input())
m = 0
count = 0

for i in range(len(S)):
    for j in range(i, len(S)):
        count = 0
        for s in list(S[i:j+1]):
            if s in ['A', 'G', 'T', 'C']:
                count += 1
            else:
                if m <= count:
                    m = count
                count = 0
print(m)

Submission status: Wrong Answer

Solution code:
from itertools import product
s = input()
if s.find("A")==-1 and s.find("C")==-1 and s.find("T")==-1 and s.find("G")==-1:
    print(0)
    exit()
for i in range(len(s)+1,1,-1):
    for j in product(["A",'C','T',"G"], repeat = i):
        t = "".join(j)
        if t in s:
            print(len(t))
            exit()

Submission status: Wrong Answer

Solution code:
S = input()
S_list = list(S)
S_ex = ''.join((['1' if (k == 'A' or k == 'C' or k == 'G' or k == 'T') else '0' for k in S_list]))
S_ans = [len(k) for k in S_ex.split('0')]
max(S_ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 24 20:27:19 2019

@author: screamLab
"""

s = input()
atcg = ['A','T','C','G']
ans = 0
long = 0
for i in range(len(s)-1):
    if s[i] in atcg:
        if s[i+1] in atcg:
            ans += 1
        else:
            ans += 1
    long = max(long,ans)
long = max(long,ans)
print(long)

Submission status: Wrong Answer

Solution code:
b = input()
let = 'ATGC'
prev = b[0]
high = 0
leng = 0
if prev in let:
    leng = 1
    high = 1
for i in range(1,len(b)):
    if leng == 0 and b[i] in let:
        leng = 1
    if b[i] in let and prev in let:
        leng += 1
    else:
        if leng > high:
            high = leng
    prev = b[i]

print(high)

Submission status: Wrong Answer

Solution code:
s="AAAAAAAAAA"

def sea(s):
    if s==[]:
        return 0
    max_agct=0
    tem_agct=0
    for i in range(len(s)):
        for j in range(len(s)-i):
            if s[i+j]=="A" or s[i+j]=="G" or s[i+j]=="C" or s[i+j]=="T":
                tem_agct+=1
          
                        
            else:
                if tem_agct>max_agct:
                    max_agct=tem_agct
                tem_agct=0
                break
                
        if i+j==len(s)-1:
            if tem_agct>max_agct:
                max_agct=tem_agct
            break
                    
    return max_agct

print(sea(s))

Submission status: Wrong Answer

Solution code:
def long(a):
    k = 0
    for i in range(len(a)-1):
        if a[i] in ['A','C','G','T'] and a[i+1] in ['A','C','G','T']:
            k = k+1
    return k+1
            
        
    
                   

a=input()
print(long(a))

Submission status: Wrong Answer

Solution code:
s=-1
S=raw_input()+"!"
ans=0
for i in range(len(S)):
  if S[i]in "ATCG":
    if s==-1:
      s=i
  else:
    ans=max(ans, i-s)
    s=-1
print ans

Submission status: Wrong Answer

Solution code:
# ATCoder
# ACGTだけ
S = input()
list = [str for str in S]

def getAns(list) :
    cnt = 0
    rtn = 0
    for i in range(len(list)) :
        if list[i] == "A" :
            cnt += 1
        elif list[i] == "C" :
            cnt += 1
        elif list[i] == "G" :
            cnt += 1
        elif list[i] == "T" :
            cnt += 1
        else :
            if rtn < cnt :
                rtn = cnt
            cnt = 0
    return rtn

print(getAns(list))

Submission status: Wrong Answer

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

out_num=0
for i in range(len(S)):
  for l in range(len(S)): 
    
    c=[x for x in S[i:-l] if x not in Check_list]
    
    if (len(c) == 0) & (len(c) >= out_num):
      out_num=len(S[i:-l])
       
print(out_num)

Submission status: Wrong Answer

Solution code:
S = input()

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

res = 0

for i in range(len(S)):
    for j in range(len(S)):
        flag = True
        for k in S[i:-j]:
            if k not in st:
                flag = False
                break
        
        if flag:
            res = max(res,len(S[i:-j]))

print(res)

Submission status: Wrong Answer

Solution code:
a = input()
sum = 0
max = 0
for i in a:
    if i is "A":
        sum += 1
    elif i is "T":
        sum += 1
    elif i is "C":
        sum += 1
    elif i is "G":
        sum += 1
    else:
        if sum > max:
            max = sum
        sum = 0
if max == 0 and sum > 0:
    max = sum
print(max)

Submission status: Wrong Answer

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

s = input()


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

Submission status: Wrong Answer

Solution code:
S = input()
s = len(S)
L = []
temp = 0
for i in range(s):
    if S[i]=='A' or S[i]=='T' or S[i]=='G' or S[i]=='C':
        if temp ==0:
            temp=1
        else:
            temp*=10
            L.append(temp)
    else:
        temp = 0
L.append(-1)        
if len(L)==1 and L[-1]==-1:
    P=0
else:
    P = len(str(max(L)))
print(P)

Submission status: Wrong Answer

Solution code:
#coding: utf-8
S = list(input())
enki = ["A", "T", "G", "C"]
a = []
ans = ""
for i in range(len(S)):
    if S[i] in enki:
        ans += S[i]
    else:
        ans = ""
    a.append(ans)
print(len(max(a)))

Submission status: Wrong Answer

Solution code:
s = input()
def check(a):
    ALLOWED = "ACGT"
    for c in a:
        if not c in ALLOWED:
            return False
    return True

ans = 0
for i in range(len(s)):
    for j in range(1, len(s) - i + 1):
        tmp = s[i: i + j]
        print(tmp)
        if check(tmp):
            ans = max(ans, len(tmp))
print(ans)

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]=="G" or s[i]=="C":
        s[i]=1
    else:
        s[i]=0
list_s=[]
for i in range(len(s)):
    flag=1
    for j in range(len(s)-i):
        if s[i+j]==0:
            list_s.append(j)
            flag=0
            break
    if flag:
        list_s.append(0)

print(max(list_s))