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:
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

s = input()
n = len(s)
ans = 0
lst = ['A','T','G','C']
for i in range(n):
    if s[i] not in lst:
        continue
    for j in range(i,n):
        if s[j] not in lst:
            break
    ans = max(ans,j-i)
print(ans)

Submission status: Wrong Answer

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

s = input()
n = len(s)
ans = 0
lst = ['A','T','G','C']
for i in range(n-1):
    if s[i] not in lst:
        continue
    for j in range(i+1,n):
        if s[j] not in lst:
            break
    ans = max(ans,j-i)
print(ans)

Submission status: Wrong Answer

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

for i in range(len(S)):
    tmp = 0
    for j in range(i, len(S)):
        if S[j] in ACGT:
            tmp += 1
            continue
        else:
            Ans = max(Ans, tmp)
            break
        
print(Ans)

Submission status: Wrong Answer

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()

S = input()

ch_list = ["A", "C", "G", "T"]

ans = 0
for i in range(len(S)-1):
    if S[i] in ch_list:
        tmp = 1
        for j in range(i+1, len(S)):
            if S[j] in ch_list:
                tmp += 1
            else:
                break   
        ans = max(ans, tmp)
    else:
        continue

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
ans = 0
ACGT = ["A","C","G","T"]
for i in range(len(S)):
    for j in range(i+1,len(S)):
        clipped_list = list(S[i:j])
        clipped = set(clipped_list)
        for acgt in ACGT:
            try:
                clipped.remove(acgt)
            except:
                pass
        if clipped == set():
            ans = max(ans,len(clipped_list))

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
sl = len(s)
l = [0]*sl
c = 0
ans = 0

for i in range(sl):
    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
        l[i] = 1

for i in range(sl):
    if l[i] == 1:
        c += 1
    else:
        ans = max(ans, c)
        c = 0

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
ACGT = 'ACGT'
ans = 0
for i in range(4):
  ans += s.count(ACGT[i])
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
count = 0
ans =0
for i in s:
    if i in 'ACGT':
        count +=1
    else:
        ans = max(ans,count)
        count = 0
print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 31 09:40:38 2020

@author: black
"""


S = list(input())

len = 0
ans = 0
for i in S:
    if i == "A" or i == "T" or i == "C" or i == "G":
        len += 1
    else:
        ans = max(len, ans)
        len = 0

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()

ans = 0
n = 0
acgt = ('A', 'C', 'G', 'T')
for si in s:
    if si in acgt:
        n += 1
    else:
        if n > ans:
            ans = n
        n = 0
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip() 

def resolve():
    S = input()
    acgt = ('A', 'C', 'G', 'T')
    ans = 0

    for l in range(len(S)):
        for r in range(l+1, len(S)+1):
            if S[r-1] not in acgt:
                ans = max(r-1-l, ans)
                break
 
    print(ans)

if __name__ == '__main__':
    resolve()

Submission status: Wrong Answer

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip() 
 
def resolve():
    S = input()
    acgt = ['A', 'C', 'G', 'T']
    ans = 0
    for l in range(len(S)):
        for r in range(l+1, len(S)+1):
            if S[r-1] not in acgt:
                ans = max(r-1-l, ans)
                break
 
    print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip() 

def resolve():
    S = input()
    acgt = ('A', 'C', 'G', 'T')
    ans = 0
    l = 0
    while (l < len(S)-1):
        r = l+1
        while (r < len(S)+1) and (S[r-1] in acgt):
            r += 1
        ans = max(r-1-l, ans)
        l += 1

    print(ans)

if __name__ == '__main__':
    resolve()

Submission status: Wrong Answer

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip() 

def resolve():
    S = input()
    acgt = ['A', 'C', 'G', 'T']
    ans = 0
    l = 0
    while (l < len(S)-1) and (len(S)-l > ans):
        r = l+1
        while (r < len(S)+1) and (S[r-1] in acgt):
            r += 1
        ans = max(r-1-l, ans)
        l += 1

    print(ans)

if __name__ == '__main__':
    resolve()

Submission status: Wrong Answer

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip() 

def resolve():
    S = input()
    acgt = ['A', 'C', 'G', 'T']
    ans = 0
    for l in range(len(S)-1):
        for r in range(l+1, len(S)+1):
            if S[r-1] not in acgt:
                ans = max(r-l-1, ans)
                break

    print(ans)

if __name__ == '__main__':
    resolve()

Submission status: Wrong Answer

Solution code:
from sys import exit
S = list(input())

for i in range(len(S)):
    for j in range(i):
        s = S[j:len(S)-i+j+1]
        valid = True
        for t in s:
            if t not in ("A", "G", "C", "T"):
                valid = False
                break
        if valid:
            print(len(S)-i+1)
            exit()

Submission status: Wrong Answer

Solution code:
S = list(map(str,input()))
count = 0
ans = 0

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

Submission status: Wrong Answer

Solution code:
#conding utf-8
S=input()
ATGC=["A","T","G","C"]
ans=0
tmp=0
for i in range(len(S)-1):
  if S[i:i+1] in ATGC:
    tmp +=1
  else:
    tmp=0
  if ans<tmp:
    ans=tmp

print(ans)

Submission status: Wrong Answer

Solution code:
s_list = list(input())
n = len(s_list)
dic = {"A", "C", "G", "T"}
ans = 0
tmp_ans = 0
for i in range(n):
    for j in range(i, n):
        print(s_list[i], s_list[j], tmp_ans, ans)
        if s_list[j] in dic:
            tmp_ans += 1
        else:
            ans = max(ans, tmp_ans)
            tmp_ans = 0
        if j == n - 1:
            ans = max(ans, tmp_ans)
            tmp_ans = 0
print(ans)

Submission status: Wrong Answer

Solution code:
import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import decimal
import heapq
import collections
import itertools
from operator import mul

sys.setrecursionlimit(100001)


# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

s = input()

ref = ["A", "C", "G", "T"]

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

print(ans)

Submission status: Wrong Answer

Solution code:
import re
ans = list(map(len, re.findall("[ACGT]+", input())))
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()

str_max = ""
int_max = 0
str_temp = ""
int_temp = 0

for i in s:
    if i == "A"or i == "C"or i == "G"or i == "T":
        str_temp += i
        int_temp += 1
    else:
        if int_max < int_temp:
            int_max = int_temp
            str_max = str_temp

        str_temp = ""
        int_temp = 0

print(int_max)

Submission status: Wrong Answer

Solution code:
s = input()

left, right = 0, 0
ans = 0
for i in range(len(s)):
    if s[i] in ["A", "G", "T", "C"]:
        right += 1
    else:
        ans = max(ans, right - left)
        right += 1
        left = right

if left == 0:
    ans = len(s)

print(ans)

Submission status: Wrong Answer

Solution code:
import re

S=input()
ans = sorted((re.findall("[AGCT]*", S)), reverse=True, key=len)
print(ans[0])

Submission status: Wrong Answer

Solution code:
import re

S=input()
ans = re.findall("[AGCT]*", S)
print(max(ans))

Submission status: Wrong Answer

Solution code:
import re

S=input()
ans = sorted(re.findall("[AGCT]*", S))
print(max(ans))

Submission status: Wrong Answer

Solution code:
import re

S=input()
ans = sorted(re.findall("[AGCT]*", S), reverse=True)
print(len(ans[0]))

Submission status: Wrong Answer

Solution code:
s_list = list(input())
n = len(s_list)
dic = {"A", "C", "G", "T"}
ans = 0
tmp_ans = 0
for i in range(n):
    for j in range(i, n):
        if s_list[j] in dic:
            tmp_ans += 1
        else:
            ans = max(ans, tmp_ans)
            tmp_ans = 0
            break
ans = max(ans, tmp_ans)
print(ans)

Submission status: Wrong Answer

Solution code:
s_list = list(input())
n = len(s_list)
dic = {"A", "C", "G", "T"}
ans = 0
tmp_ans = 0
for i in range(n):
    for j in range(i, n):
        print(s_list[i], s_list[j])
        if s_list[j] in dic:
            tmp_ans += 1
        else:
            ans = max(ans, tmp_ans)
            tmp_ans = 0
            break
ans = max(ans, tmp_ans)
print(ans)

Submission status: Wrong Answer

Solution code:
s_list = list(input())
n = len(s_list)
dic = {"A", "C", "G", "T"}
ans = 0
tmp_ans = 0
for i in range(n):
    for j in range(i, n):
        if s_list[j] in dic:
            tmp_ans += 1
        else:
            ans = max(ans, tmp_ans)
            tmp_ans = 0
            break
print(ans)

Submission status: Wrong Answer

Solution code:
check = ["A", "C", "G", "T"]

s = input()
ans = 0
tmp = 0

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

Submission status: Wrong Answer

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

max_len = 0
now = 0
for char in s:
    if char not in atcg:
        max_len = now if now > max_len else max_len
        now = 0
        continue
    now += 1
print(max_len)

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/abc122/tasks/abc122_b


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

ans = 0
n = 0
for s in S:
    if s in SPECIAL:
        n += 1
    else:
        if ans < n:
            ans = n
        n = 0

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()

S = i_s()

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

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()

result = ""
result_old = ""

#現在の文字列の長さ
#1個前の文字列の長さ
count = 0
for i in range(int(len(s))):
    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
        result = result +s[i]
        count += 1
    else:
        if int(len(result_old)) <= int(len(result)):
            print("result_old=",result_old)
            result_old = result
        else:
            result = [None for _ in range(int(len(result)))]
            result = ""

if count == int(len(s)):
    result_old = result

if s == "A" or s == "C" or s == "G" or s == "T":
    result_old = "A"
print(len(result_old))

Submission status: Wrong Answer

Solution code:
s = input()

result = ""
result_old = ""

#現在の文字列の長さ
#1個前の文字列の長さ

for i in range(int(len(s))):
    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
        result = result +s[i] 
    else:
        if int(len(result_old)) <= int(len(result)):
            result_old = result
        else:
            result = [None for _ in range(int(len(result)))]
            result = ""


if s == "A" or s == "C" or s == "G" or s == "T":
    result_old = "A"
print(len(result_old))

Submission status: Wrong Answer

Solution code:
s = input()

result = ""
result_old = ""

#現在の文字列の長さ
#1個前の文字列の長さ

for i in range(int(len(s))):
    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
        result = result +s[i] 
    else:
        if int(len(result_old)) <= int(len(result)):
            result_old = result
        else:
            result = [None for _ in range(int(len(result)))]
            result = ""

if s == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
    result_old = "A"
print(len(result_old))

Submission status: Wrong Answer

Solution code:
s=input()
count=0
maxcount=0

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

print(maxcount)

Submission status: Wrong Answer

Solution code:
s = input()

result = ""
result_old = ""

#現在の文字列の長さ
#1個前の文字列の長さ

for i in range(int(len(s))):
    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
        result = result +s[i] 
    else:
        if int(len(result_old)) <= int(len(result)):
            result_old = result
        else:
            result = [None for _ in range(int(len(result)))]
            result = ""

if int(len(s)) == 1:
        result_old = "A"
print(len(result_old))

Submission status: Wrong Answer

Solution code:
s = input()

result = ""
result_old = ""

#現在の文字列の長さ
#1個前の文字列の長さ

for i in range(int(len(s))):
    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
        result = result +s[i] 
    else:
        if int(len(result_old)) < int(len(result)):
            result_old = result
        else:
            result = [None for _ in range(int(len(result)))]
            result = ""
print(len(result_old))

Submission status: Wrong Answer

Solution code:
import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *
from math import *
from fractions import *

sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()

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

Submission status: Wrong Answer

Solution code:
print(sum(1 for c in input() if c in 'AGCT'))

Submission status: Wrong Answer

Solution code:
s = input()

result = ""
for i in range(int(len(s))):
    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
            result = result +s[i]
print(len(result))

Submission status: Wrong Answer

Solution code:
S=input()
count=0
max_count=-1
for i in range(len(S)):
    if S[i]!="A" and S[i]!="C" and S[i]!="G" and S[i]!="T":
        count=count+1
    else:
        if max_count<count:
            max_count=count
        count=0
print(max_count)

Submission status: Wrong Answer

Solution code:
S=input()
count=0
max_count=-1
for i in range(len(S)):
    if S[i]!="A" and S[i]!="C" and S[i]!="G" and S[i]!="T":
        count=count+1
    else:
        if max_count<count:
            max_count=count
            count=0
print(max_count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

S = input()
N = len(S)
m = 0
for i in range(N):
    for j in range(i+1):
        s = S[j:i]
        l = list(s)
        l = [k for k in l if k not in ["A", "G", "C", "T"]]
        if len(l) == 0:
            m = max(m, i-j)
print(m)

Submission status: Wrong Answer

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    atcg=set(['A','T','C','G'])
    s=STR()
    ct=0
    for i in range(len(s)):
        if s[i] in atcg:
            temp=1
            for k in range(1,len(s)-i-1):
                if s[i+k] in atcg:
                    temp+=1
                    #print('aa')
                else:
                    break
            ct=max(temp,ct)
    print(ct)
if __name__ == '__main__':
    do()

Submission status: Wrong Answer

Solution code:
s=input()
cnt=0
temp=0
for i in s:
    if i in 'ATGC':
        temp+=1
        continue
    if cnt<temp:
        cnt=temp
        temp=0

print(cnt)

Submission status: Wrong Answer

Solution code:
s=input()
cnt=0
temp=0
for i in s:
    if i in 'ATGC':
        temp+=1
        continue
    if cnt<temp:cnt=temp
    temp=0

print(cnt)

Submission status: Wrong Answer

Solution code:
s = input()
ans = 0
for start in range(len(s)):
    for end in range(len(s)):
        tmps = s[start:end]
        if set(tmps) <= {"A","G","C","T"}:
            ans = max(ans,len(tmps))
print(ans)

Submission status: Wrong Answer

Solution code:
def inpl():
    return list(map(int, input().split()))


S = input()

ans = 0
for i in range(len(S)):
    for j in range(i, len(S)):
        if S[j] not in "AGTC":
            ans = max(j - i, ans)
            break
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()

c = 0
cmax = -1
for s in S:
  if s in ['A', 'C', 'G', 'T']:
    c += 1
  else:
    if c > cmax:
      cmax = c
    c = 0

print(cmax)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

        
        
            count=0
print(s)

Submission status: Wrong Answer

Solution code:
a=input()
count=0
s=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
        s=count
    else:
        if count>s:
            s=count

        
        
        count=0
print(s)

Submission status: Wrong Answer

Solution code:
a=input()
count=0
s=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:
        if count>s:
            s=count

        
        
        count=0
print(s)

Submission status: Wrong Answer

Solution code:
S = input()

max_len = 0
for i in range(len(S)):
    for j in range(i, len(S)):
        tmp = S[i:j]
        for t in tmp:
            if t != 'A' and t != 'C' and t != 'G' and t != 'T':
                break
        else:
            if len(tmp) >= max_len:
                max_len = len(tmp)

print(max_len)

Submission status: Wrong Answer

Solution code:
N = list(input())
print(N)
m = 0
cnt = 0
for x in N:
    
    if x == 'A' or x == 'C' or x == 'G' or x == 'T':
        cnt += 1
    else:
        m = max(cnt, m)
        cnt = 0

m = max(cnt, m)

print(m)

Submission status: Wrong Answer

Solution code:
ACGT = ['A', 'C', 'G', 'T']
def ok(S):
    for c in S:
        if c not in ACGT:
            return False
    return True
def main():
    S = input()
    res = ''
    for i in range(len(S)-1):
        for j in range(1, len(S)):
            ps = S[i:j]
            if ok(ps) and len(ps) > len(res):
                res = ps

    print(len(res))
    

main()

Submission status: Wrong Answer

Solution code:
s=input()
ACGT=["A","C","G","T"]
moji=[]
for i in range(len(s)):
    #print(moji)
    if s[i] in ACGT:
        moji.append(s[i])
        for j in range(i+1,len(s)):
            if s[j] in ACGT:
                moji[i]+=s[j]
            else:
                break
    else:
        moji.append("?")
index=0
for i in moji:
    moji[index]=len(i)
    index+=1
print(max(moji))

Submission status: Wrong Answer

Solution code:
import re

s = input()

regex = re.compile(r'([ACGT]+)')
mo = regex.search(s)
if mo != None:
    f, l = mo.span()
    ans = l - f
    print(ans)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
s = input()
maxi = 0

for start in range(len(s)):
    for end in range(start, len(s)):
        st = s[start:end]
        
        flag = True
        for ss in st:
            if ss!='A' and ss!='C' and ss!='G' and ss!='T':
                flag = False
            
        if flag:
            if len(st)>maxi:
                maxi=len(st)

print(maxi)

Submission status: Wrong Answer

Solution code:
pattern = ["A", "T", "G", "C"]

s = input()

max_count = 0
count = 0
for c in s:
    if c in pattern:
        count += 1
    else:
        max_count = max(count, max_count)
        count = 0

print(max_count)

Submission status: Wrong Answer

Solution code:
pattern = ["A", "T", "G", "C"]

s = input()

max_count = 0
count = 0
for c in s:
    if s in pattern:
        count += 1
    else:
        max_count = max(count, max_count)
        count = 0
max_count = max(count, max_count)
print(max_count)

Submission status: Wrong Answer

Solution code:
pattern = ["A", "T", "G", "C"]

s = input()

max_count = 0
count = 0
for i in range(len(s)):
    if s[i] in pattern:
        count+=1
    else:
        max_count = max(count, max_count)
        count = 0
        
print(max_count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import re

S = input()
raw = '[ACGT]+'
pattertn = re.compile(raw)
p = pattertn.search(S)
if p is None:
    print(0)
else:
    print(p.end()-p.start())

Submission status: Wrong Answer

Solution code:
import re

S = input()
pattern = '[ACGT]+'
m = re.search(pattern, S)
if m is None:
    print(0)
else:
    print(m.end() - m.start())

Submission status: Wrong Answer

Solution code:
s = input()
ans = 0
for l in range(len(s) - 1):
    for r in range(l+1, len(s)):
        if set(s[l:r]).issubset({"A", "T", "C", "G"}):
            ans = max(ans, len(s[l:r]))
print(ans)

Submission status: Wrong Answer

Solution code:
s = str(input())
acgt = {"A", "C", "G", "T"}

ans = 0
for i in range(len(s)):
    for j in range(i, len(s)):
        t = s[i: j]
        for k in t:
            if k not in acgt:
                break
        else:
            ans = max(ans, len(t))
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
list_s = list(s)
ans = 0
for c in list_s:
    if c == "A" or c == "C" or c == "G" or c == "T":
        ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
list_s = list(s)
k = 0
ans = 0
for c in list_s:
    if c == "A" or c == "C" or c == "G" or c == "T":
        k += 1

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
list_s = list(s)
k = 0
ans = [0]
for c in list_s:
    if c == "A" or c == "C" or c == "G" or c == "T":
        k += 1
    else:
        ans.append(k)
        k = 0

print(max(ans))

Submission status: Wrong Answer

Solution code:
s = input()
m = 0
l = 0
for c in s:
    if not (c == 'A' or c == 'C' or c == 'G' or c == 'T'):
        m = max(m, l)
        l = 0
        continue

    l += 1

print(m)

Submission status: Wrong Answer

Solution code:
s = input()
m = 0
l = 0
for c in s:
    if not (c == 'A' or c == 'C' or c == 'G' or c == 'T'):
        m = max(m, l)
        l = 0
        continue

    l += 1

print(l)

Submission status: Wrong Answer

Solution code:
import re
S = list(input())
for i in range(len(S)):
    if (re.match(r'[ATCG]', S[i]) is None):
        S[i]=""
Max = 0
count = 0
for i in range(len(S)):
    if S[i]=="":
        if count>Max:
            Max = count
        count=0
    else:
        count+=1
print(Max)

Submission status: Wrong Answer

Solution code:
s = input()
l = []
cnt = 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
        #print(cnt)
        if i == len(s) - 1:
            l.append(cnt)
            
        
        
        
    elif i != "A" or i !="C" or i != "G" or i != "T":
        l.append(cnt)

print(max(l))

Submission status: Wrong Answer

Solution code:
S=input()
N=len(S)
ans=0
d=set(list("AGCT"))

for i in range(N+1):
    for j in range(N+1):
        s=S[i:j]
        print(s)
        if set(list(s))<=d:
            ans=max(ans,len(s))
            
print(ans)

Submission status: Wrong Answer

Solution code:
S=input()
N=len(S)
ans=0
d=set(list("AGCT"))

for i in range(N):
    for j in range(N):
        s=S[i:j]
        if set(list(s))<=d:
            ans=max(ans,len(s))
            
print(ans)

Submission status: Wrong Answer

Solution code:
s=list(input())
ans=0
for q in s:
    if q in ["A","T","G","C"]:ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

S = input().rstrip('\r\n')
ans = 0
count = 0
for s in S:
    if s == 'A' or s == 'C' or s == 'G' or s == 'T':
        count += 1
    else:
        ans = max(ans, count)
        count = 0
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
count = 0
count_max = 0
for i in range(len(S)):
    if S[i] in 'ACGT':
        count += 1
        continue
    else:
        max(count_max,count)
        count = 0

print(count_max)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
count = 0
count_max = 0
for i in range(len(S)):
    if S[i] == 'A' or S[i] == 'C' or S[i] == 'G' or S[i] == 'T':
        count += 1
        continue
    else:
        max(count_max,count)

print(count_max)

Submission status: Wrong Answer

Solution code:
S = input()
count = 0
count_max = 0
for i in range(len(S)):
    if S[i] == 'A' or S[i] == 'C' or S[i] == 'G' or S[i] == 'T':
        count += 1
        continue
    else:
        if count_max <= count:
            count_max = count

print(count_max)

Submission status: Wrong Answer

Solution code:
S = input()
count = 0
count_max = 0
for i in range(len(S)):
    if S[i] == 'A' or S[i] == 'C' or S[i] == 'G' or S[i] == 'T':
        count += 1
        continue
    else:
        count
    if count_max < count:
        count_max = count

print(count_max)

Submission status: Wrong Answer

Solution code:
s=input()
count,ans=0,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:
S = input()
mode = 0
now = 0
k = []
for i in range(len(S)):
    if str(S[i]) == "A" or str(S[i]) == "T" or str(S[i]) == "G" or str(S[i]) == "C":
        if mode == 0:
            mode = 1
            now += 1
        else:
            now += 1
    else:
        k.append(now)
        now = 0
        mode = 0
if len(k) == 0:
    print(0)
else:
    print(max(k))