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:
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

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

Submission status: Wrong Answer

Solution code:
S = input()
RES = 0

def countACGT(s):
  res = 0
  res += s.count("A")
  res += s.count("C")
  res += s.count("G")
  res += s.count("T")
  return res

for i in range(len(S)+1):
  for j in range(len(S)+1):
    RES = max(RES,countACGT(S[i:j]))
print(RES)

Submission status: Wrong Answer

Solution code:
S = input()
RES = 0

def countACGT(s):
  res = 0
  res += s.count("A")
  res += s.count("C")
  res += s.count("G")
  res += s.count("T")
  return res

for i in range(len(S)):
  for j in range(len(S)):
    RES = max(RES,countACGT(S[i:j]))
print(RES)

Submission status: Wrong Answer

Solution code:
import re
S = input()
a = re.compile("[ACGT]+")
b = re.findall(a,S)
if b:
    print(len(max(b)))
else:
    print(0)

Submission status: Wrong Answer

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

print(max(ans))

Submission status: Wrong Answer

Solution code:
s=input()

score=0

for i in range(len(s)):
    for j in range(i,len(s)):
        isbad = 0
        for k in range(i,j+1):
            if s[k] != "A" and s[k] != "C" and s[k] != "G" and s[k] != "T": 
                isbad=1
                break
        if isbad==0:
            score = max(j+1-i,score)
            print(s[i:j+1])
        
print(score)

Submission status: Wrong Answer

Solution code:
s=input()

score=0

for i in range(len(s)-1):
    for j in range(i+1,len(s)):
        isbad = 0
        for k in range(i,j+1):
            if s[k] != "A" and s[k] != "C" and s[k] != "G" and s[k] != "T": 
                isbad=1
                break
        if isbad==0:
            score = max(j+1-i,score)
            print(s[i:j+1])
        
print(score)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()

for n in range(len(s)):
  if s[n] == "A" or s[n] == "C" or s[n] == "G" or s[n] == "T":
    break
  else:
    continue
if n == len(s)-1:
  print(0)
else:
  for m in range(n+1,len(s)):
    if s[m] == "A" or s[m] == "C" or s[m] == "G" or s[m] == "T":
      continue
    else:
      break
  print(len(s[n:m]))

Submission status: Wrong Answer

Solution code:
S = input()

c = 0
m = 0
l = []
for i in range(len(S)):
    if S[i] == "A" or S[i] == "C" :
        c += 1
    elif S[i] == "G" or S[i] == "T" :
        c += 1
    else :
        m = max(c,m)
        c = 0

print(m)

Submission status: Wrong Answer

Solution code:
N = input()
ACGT = ["A", "C", "G", "T"]

ans = 0
count = 0
for n in N:
    if n in ACGT:
        count += 1
    else:
        ans = max(ans, count)
        count = 0
print(ans)

Submission status: Wrong Answer

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

    check = [1 if s[i] in acgt else 0 for i in range(len(s))]

    result = 0
    for i in range(len(check)):
        for j in range(i, len(check)):
            if check[i:j].count(0) == 0:
                if result < len(check[i:j]):
                    result = len(check[i:j])

    print(result)

if __name__ == '__main__':
    abc122_b()

Submission status: Wrong Answer

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

    check = [1 if s[i] in acgt else 0 for i in range(len(s))]

    result = 0
    for i in range(len(check)):
        for j in range(len(check)):
            if check[i:j].count(0) == 0:
                if result < len(check[i:j]):
                    result = len(check[i:j])

    print(result)

if __name__ == '__main__':
    abc122_b()

Submission status: Wrong Answer

Solution code:
s = input()
res = 0
cnt = 0
for i in range(len(s)):
    if s[i] in 'ATGC':cnt += 1
    else:
        res = max(res, cnt)
        cnt = 0
print(res)

Submission status: Wrong Answer

Solution code:
n = list(input())

count = 0

word = 0
flag = 0

for j in range(len(n)):
  if(flag == 0):
    if(n[j] == 'A' or n[j] == 'C' or n[j] == 'T' or n[j] == 'G'):
      word += 1
      flag = 1
  else:
    if(n[j] != 'A' and n[j] != 'C' and n[j] != 'T' and n[j] != 'G'):
      if(count < word):
        count = word
      word = 0
      flag = 0
    else:
      word += 1

print(count)

Submission status: Wrong Answer

Solution code:
n = list(input())

count = 0

for i in range(len(n)):
  word = 0
  flag = 0
  for j in range(i, len(n)):
    if(flag == 0):
      if(n[j] == 'A' or n[j] == 'C' or n[j] == 'T' or n[j] == 'G'):
        word += 1
        flag = 1
    else:
      if(n[j] != 'A' and n[j] != 'C' and n[j] != 'T' and n[j] != 'G'):
        if(count < word):
          count = word
        word = 0
        flag = 0
      else:
        word += 1

print(count)

Submission status: Wrong Answer

Solution code:
n = list(input())

count = 0

for i in range(len(n)):
  word = 0
  flag = 0
  for j in range(i, len(n)):
    if(flag == 0):
      if(n[j] == 'A' or n[j] == 'C' or n[j] == 'T' or n[j] == 'G'):
        word += 1
        flag = 1
    else:
      if(n[j] != 'A' and n[j] != 'C' and n[j] != 'T' and n[j] != 'G'):
        if(count < word):
          count = word
          word = 0
        flag = 0
      else:
        word += 1

print(count)

Submission status: Wrong Answer

Solution code:
n = list(input())

count = 0

for i in range(len(n)):
  word = 0
  flag = 0
  for j in range(i, len(n)):
    if(flag == 0):
      if(n[j] == 'A' or n[j] == 'C' or n[j] == 'T' or n[j] == 'G'):
        word += 1
        flag = 1
    else:
      if(n[j] != 'A' and n[j] != 'C' and n[j] != 'T' and n[j] != 'G'):
        if(count < word):
          count = word
        flag = 0
      else:
        word += 1

print(count)

Submission status: Wrong Answer

Solution code:
n = list(input())

count = 0

for i in range(len(n)):
  word = 0
  flag = 0
  for j in range(i, len(n)):
    if(flag == 0):
      if(n[j] == 'A' or n[j] == 'C' or n[j] == 'T' or n[j] == 'G'):
        word += 1
        flag = 1
    else:
      if(n[j] != 'A' and n[j] != 'C' and n[j] != 'T' and n[j] != 'G'):
        if(count < word):
          count = word
        break
      else:
        word += 1

print(count)

Submission status: Wrong Answer

Solution code:
def main():
    s = input()
    n = len(s)
    ans = 0
    for i in range(n):
        for j in range(i + 1, n):
            if set(s[i:j]) - {"A", "C", "G", "T"} == set():
                ans = max(ans, len(s[i:j]))
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
S = input()
ACGT = set("A""C""G""T")
tmp = 0
maxans = 0
for i in S:
  if i in ACGT:
    tmp += 1
  else:
    maxans =max(maxans,tmp)
    tmp = 0
print(maxans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#n=int(input())
#n,m=map(int,input().split())
#hl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
s=list(input())
n=len(s)
mx=0
temp=0
l=['A','C','G','T']
for i in range(n):
    if s[i] in l:
        temp+=1
    else:
        mx=max(mx,temp)
        temp=0
print(mx)

Submission status: Wrong Answer

Solution code:
import sys
import re
S = input()
if not ( 1 <= len(S) <= 10 ): sys.exit()
if not S.isupper: sys.exit()

result = 0
max = max(re.findall('[A|T|G|C]+', S)) if re.findall('[A|T|G|C]+', S) else ''
if len(max) > 0:result = len(max)
print(result)

Submission status: Wrong Answer

Solution code:
S = input()

ACGT = 'A C G T'.split()
result = 0
tmp = 0
for i in S:
    if i in ACGT:
        tmp += 1
    else:
        if tmp > result:
            result = tmp
        tmp = 0

print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

s = input().rstrip()

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

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()

ACGT = ['A', 'C', 'G', 'T']
cntList = []
cnt = 0
cntList.append(cnt)
for s in S:
    if s in ACGT:
        cnt += 1
    else:
        cntList.append(cnt)
        cnt = 0
print(max(cntList))

Submission status: Wrong Answer

Solution code:
S = input()
t, m = 0, 0
for s in S:
  if s in ["A", "C", "G", "T"]:
    t += 1
  else:
    m = max(m, t)
    t = 0
print(m)

Submission status: Wrong Answer

Solution code:
S = input()
mx = 0
count = 0
for x in S :
    if x in "ATGC" :
        count += 1
    else :
        mx = max(mx, count)
        count = 0
max = max(mx, count)
print(mx)

Submission status: Wrong Answer

Solution code:
import re
S = input()
num = len(S)
S = re.sub('[^A|^C|^G|^T]+', ' ', S).split(' ')
print(len(max(S)))

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)+2):

    cnt = 0

    for str in s[l:r]:

      if str not in ['A','C','G','T']:

        cnt = 0 

        break

      else:

        cnt += 1

    ans = max(ans, cnt)

print(ans)

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)+1):

    cnt = 0

    for str in s[l:r]:

      if str not in ['A','C','G','T']:

        cnt = 0 

        break

      else:

        cnt += 1

    ans = max(ans, cnt)

print(ans)

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)+1):
    cnt = 0
    for str in s[l:r+1]:
      if str not in ['A','C','G','T']:
        cnt = 0 
        break
      else:
        cnt += 1
    ans = max(ans, cnt)
print(ans)

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)):
    cnt = 0
    for str in s[l:r+1]:
      if str not in ['A','C','G','T']:
        cnt = 0 
        break
      else:
        cnt += 1
    ans = max(ans, cnt)
print(ans)

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)):
    cnt = 0
    for str in s[l:r]:
      if str not in ['A','C','G','T']:
        cnt = 0 
        break
      else:
        cnt += 1
    ans = max(ans, cnt)
print(ans)

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)):
    cnt = 0
    for str in s[l:r]:
      if str not in ['A','C','G','T']:
        cnt = 0
        break
      else:
        cnt += 1
    ans = max(ans, cnt)
print(ans)

Submission status: Wrong Answer

Solution code:
#18
S = input()
N = len(S)
mozi = ["A","C","G","T"]
cou = 0
Max = 0
n = 0
for i in range(N):
    n = 0
    for j in mozi:
        if S[i] == j:
            cou += 1
            n = 0
        else:
            n+=1
            if cou > Max:
                Max = cou 
            if n == 4:
                cou = 0
                n = 0

print(Max)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)

s = input()

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

ans = 0
tmp = 0

for ch in s:
    if ch in l:
        tmp += 1
    else:
        ans = max(ans, tmp)
        tmp = 0
        
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()

ans = 0
for i in range(len(s) - 1):
    for j in range(i + 1, len(s) + 1):
        cnt = 0
        for k in ["A", "G", "C", "T"]:
            cnt += s[i:j].count(k)
        if cnt == len(s[i:j]):
            ans = max(ans, cnt)

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()

s = []

for i in range(len(S)):
    if S[i] == 'A' or S[i] == 'C' or S[i] == 'G' or S[i] == 'T':
        s.append(i)

ans = 0

count = 1
for i in range(len(s)-1):
    if s[i] + 1 == s[i+1]:
        count += 1
    else:
        count = 1
    if ans < count:
        ans = count
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()

tmp = 0
atcgmax = 0
for i in range(len(S)):
    if S[i] == 'A' or  S[i] == 'T' or S[i] == 'C' or S[i] == 'G':
        tmp += 1
    else:
        atcgmax = max(tmp,atcgmax)
        tmp = 0

print(atcgmax)

Submission status: Wrong Answer

Solution code:
S = input()
counter = 0
max_ = 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:
        max_ = max(max_,counter) 
        counter = 0
print(max_)

Submission status: Wrong Answer

Solution code:
S = input()
count = 0
max = 0
ans = 0
flag=True
for i in range(len(S)):
  if S[i] != "A" and S[i] != "C" and S[i] != "G" and S[i] != "T":
    max = count
    count = 0
    flag=False
  if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
    count += 1
  if max > ans:
    ans = max
if flag == False:
    print(ans)
elif flag == True:
  print(count)

Submission status: Wrong Answer

Solution code:
S = input()
count = 0
max = 0
ans = 0

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

Submission status: Wrong Answer

Solution code:
S = input()
count = 0
max = 0
ans = 0

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

Submission status: Wrong Answer

Solution code:
S = input()
count = 0
max = 0
ans = 0

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

Submission status: Wrong Answer

Solution code:
def resolve():
    S = str(input().split())
    ans = 0

    for pos in range(len(S)):
        for ln in range(pos, len(S)-pos):
            cnt = 0
            cnt += S[pos: (pos + ln)].count('A')
            cnt += S[pos: (pos + ln)].count('C')
            cnt += S[pos: (pos + ln)].count('G')
            cnt += S[pos: (pos + ln)].count('T')
            if cnt == ln:
                ans = max(ans, len(S[pos: (pos + ln)]))

    print(ans)
    return

resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
    S = str(input().split())
    ans = 0

    for pos in range(len(S)):
        for ln in range(pos, len(S)):
            cnt = 0
            cnt += S[pos: (pos + ln)].count('A')
            cnt += S[pos: (pos + ln)].count('C')
            cnt += S[pos: (pos + ln)].count('G')
            cnt += S[pos: (pos + ln)].count('T')
            if cnt == ln:
                ans = max(ans, len(S[pos: (pos + ln)]))

    print(ans)
    return


resolve()

Submission status: Wrong Answer

Solution code:
S = input()
m = 0
for i in range(len(S)):
  for j in range(i, len(S)):
    if S[j] not in ["A", "C", "G", "T"]:
      m = max(m, j-i)
      break
print(m)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = ""
for i in range(len(S)):
    s = S[i:i+1]
    if s in atcg:
        ans += s
        if S[i+1:i+2] not in atcg:
            break

print(len(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = list(input())
a = ""
ans = 0
for c in s:
    if c in ("A", "C", "G", "T"):
        a += c
    else:
        ans = max(ans, len(a))
        a = ""
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
checklist=["A","C","G","T"]
sn = list(input())

answer = 0
count = 0
for s in sn :
  if s in checklist:
    count += 1
  else :
    answer = max(answer,count)
    count = 0

print(answer)
print(sn)

Submission status: Wrong Answer

Solution code:
checklist=["A","C","G","T"]
sn = list(input())

answer = 0
count = 0
for s in sn :
  if s in checklist:
    count += 1
  else :
    answer = max(answer,count)
    count = 0

print(answer)

Submission status: Wrong Answer

Solution code:
checklist=["A","C","G","T"]
sn = list(input())

answer = 0
count = 0
for i in range(len(sn)) :
  if sn[i] in checklist:
    count += 1
  else :
    answer = max(answer,count)
    count = 0

print(answer)

Submission status: Wrong Answer

Solution code:
checklist=["A","C","G","T"]
sn = list(input())

answer = 0
for i in range(len(sn)) :
  if sn[i] in checklist:
    count = 1
    for j in range(i+1,len(sn)):
      if sn[j] in checklist:
        count += 1
      else :
        if answer < count:
          answer = count
        break

print(answer)

Submission status: Wrong Answer

Solution code:
S = input()
ma = 0
ma_ = 0
for c in S:
    if c == 'A' or c == 'C' or c == 'G' or c == 'T':
        ma_ += 1
    else:
        ma = max(ma, ma_)
        ma_ = 0

print(ma)

Submission status: Wrong Answer

Solution code:
S = input()

AGCT = ['A','G','C','T']
AGCT_list = []

i = 0
while i < len(S):
    print('i=',i)
    if S[i] in AGCT:
        k = 1
        agct_tmp = S[i]
        if i+k < len(S):
            while S[i+k] in AGCT:
                #print('k=', k)
                #print('i+k=',i+k)
                agct_tmp += S[i+k]
                if i+k+1 < len(S):
                    k +=1
                else:
                    break
    
        AGCT_list.append(agct_tmp)
        i = i + k + 1
    else:
        i += 1
if AGCT_list:
    print(max([len(string) for string in AGCT_list]))
else:
    print('0')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
"""abc122_b"""
S = input()

CNT = 0

ANS = [0]
for s in S:
    if s in "ACTG":
        CNT += 1
    elif CNT != 0:
        ANS.append(CNT)
        CNT = 0

print(max(ANS))

Submission status: Wrong Answer

Solution code:
s = input()
counter = 0
big = 0

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

Submission status: Wrong Answer

Solution code:
s = input()
counter = 0
big = 0

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

Submission status: Wrong Answer

Solution code:
def resolve():
    '''
    code here
    '''
    S = input()

    front = -1
    end = 0
    for i in range(len(S)):
        if S[i] in ['A', 'C', 'G', 'T']:
            front = i
            break

    for i in range(len(S)):
        if S[-1*(i+1)] in ['A', 'C', 'G', 'T']:
            end = i
            break
    if front == -1:
        print(0)
    elif front == len(S) -1 - end:
        print(1)
    else:
        print(len(S) - end - front)

if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
    '''
    code here
    '''
    S = input()

    front = -1
    end = 0
    for i in range(len(S)):
        if S[i] in ['A', 'C', 'G', 'T']:
            front = i
            break

    for i in range(len(S)):
        if S[-1*(i+1)] in ['A', 'C', 'G', 'T']:
            end = i
            break
    if front == -1:
        print(0)
    else:
        print(len(S) - end - front)

if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
    '''
    code here
    '''
    S = input()

    front = -1
    end = 0
    for i in range(len(S)):
        if S[i] in ['A', 'C', 'G', 'T']:
            front = i
            break

    for i in range(len(S)):
        if S[-1*(i+1)] in ['A', 'C', 'G', 'T']:
            end = -1*(i+1)
            break

    if front == -1:
        print(0)
    elif end == -1:
        print(len(S[front:]))
    else:
        print(len(S[front:end+1]))


if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
acgt = {'A','C','G','T'}
m = 0
c = 0
for s in S:
  if s in acgt:
    c+=1
  else:
    m = max(m,c)
    c = 0
print(m)

Submission status: Wrong Answer

Solution code:
S = input()
F = "ATGC"
cnt = 0
n = len(S)
for i in range(n-1):
  for j in range(i+1, n):
    flg = True
    for k in range(i, j):
      flg *= (S[k] in F)
    if flg:
      cnt = max(cnt, j - i)
print(cnt)

Submission status: Wrong Answer

Solution code:
S = input()
F = "ATGC"
cnt = 0
n = len(S)
for i in range(n-1):
  for j in range(i+1, n):
    flg = True
    for k in range(i, j):
      flg *= (S[i] in F)
    if flg:
      cnt = max(cnt, j - i)
print(cnt)

Submission status: Wrong Answer

Solution code:
S = input()
F = "ATGC"
cnt = 0
for i in S:
  if i in F:
    cnt += 1
print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l = ('A', 'T', 'C', 'G')
S = input()

ans = [0]
res = 0
for i in range(len(S)):
    if S[i] in l:
        res += 1
    elif res != 0:
        ans.append(res)
        res = 0

print(max(ans))

Submission status: Wrong Answer

Solution code:
l = ('A', 'T', 'C', 'G')
S = input()

ans, res = 0, 0
for i in range(len(S)):
    if S[i] in l:
        res += 1
    else:
        ans = max(ans, res)
        res = 0

print(ans)

Submission status: Wrong Answer

Solution code:
l = ('A', 'T', 'C', 'G')
S = input()

ans, res = 0, 0
for i in range(len(S)):
    if S[i] in l:
        res += 1
    else:
        ans = max(ans, res)

print(ans)

Submission status: Wrong Answer

Solution code:
s=input()
Flag=True
cnt=0
ans=0
for i in range(len(s)):
    if s[i] in 'ACGT':
        cnt+=1

    else:
        ans=max(ans,cnt)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
ans = 0
count = 0
for s in S:
    if s not in "AGCT":
        ans = max(ans, count)
        count = 0
    else:
        count += 1

print(ans)

Submission status: Wrong Answer

Solution code:
import bisect,collections,copy,heapq,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

s = S()
cnt = 0
max_reg = 0
for x in s:
    if 'A' in x or 'C' in x or 'G' in x or 'T' in x:
        cnt += 1
    else:
        max_reg = max(max_reg,cnt)
        cnt = 0
print(max_reg)

Submission status: Wrong Answer

Solution code:
s = input()

x = ["A","c","G","T"]

ans = 0
cnt = 0

for i in s:
    if i not in x:
        cnt += 1
    else:
        ans = max(ans,cnt)
        cnt = 0
        
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()

x = ["A","c","G","T"]

ans = 0
cnt = 0

for i in s:
    if i not in x:
        cnt += 1
    else:
        ans = max(ans,cnt)
        cnt = 0

Submission status: Wrong Answer

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

def get_input() -> str:
    """
    標準入力を取得する.

    Returns:\n
        str: 標準入力
    """
    S = input()

    return S


def main(S: str) -> None:
    """
    メイン処理.

    Args:\n
        S (str): 長さ1以上10以下の英大文字列
    """
    # 求解処理
    N = len(S)
    ans = 0
    for i in range(N):
        for j in range(i + 1, N):
            if all("ACGT".count(c) == 1 for c in S[i: j + 1]):
                ans = max(ans, j - i + 1)

    # 結果出力
    print(ans)


if __name__ == "__main__":
    # 標準入力を取得
    S = get_input()

    # メイン処理
    main(S)

Submission status: Wrong Answer

Solution code:
S=input()
T='ATCG'
 
flag =0
ans =0
 
for i in range(len(S)):
    flag =0
    for j in range(i,len(S)-i):
        if S[j] == 'A' or S[j] == 'G' or S[j] == 'T' or S[j] == 'C':
            flag +=1
            ans = max(ans,flag)
        else:
            break
        
print(ans)

Submission status: Wrong Answer

Solution code:
S=input()

flag =0
ans =0

for i in range(len(S)):
    flag =0
    for j in range(len(S)-i):
        if S[i+j] == 'A' or S[i+j] == 'G' or S[i+j] == 'T' or S[i+j] == 'C':
            flag +=1
        else:
            ans = max(ans,flag)
            flag =0
            break
        
print(ans)

Submission status: Wrong Answer

Solution code:
S=input()

flag =0
ans =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] == 'T' or S[i+j] == 'C':
            flag +=1
        else:
            ans = max(ans,flag)
            flag =0
            break       

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S=input()
c=0
d=0
for i in S:
    if i=="A":
        c+=1
    elif i=="C":
        c+=1
    elif i=="G":
        c+=1
    elif i=="T":
        c+=1
    else:
        if c>d:
            d=c
        c=0
print(d)

Submission status: Wrong Answer

Solution code:
s = input()
longest = 0

n_max = 0
for i, x in enumerate(s):
  if x in ["A", "C", "G", "T"]:
    n_max += 1
  else:
    longest = max(longest, n_max)
    n_max = 0
    
print(longest)

Submission status: Wrong Answer

Solution code:
if __name__ =='__main__':
    s = input()
    ans = 0
    seq = 0
    for c in s:
        if c=='A' or c=='T' or c=='G' or c=='C':
            seq+=1
        else:
            ans = max(ans,seq)
    ans = max(ans,seq)
    print(ans)

Submission status: Wrong Answer

Solution code:

def main():
    s = input()
    ans = 0
    seq = 0
    for c in s:
        if c == 'A' or c == 'C' or c == 'T' or c == 'G':
            seq+=1
        else:
            ans = max(ans,seq)
            seq=0
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
s = input()
ans = 0
tmp = 0
for x in s:
    if x in ["A", "C", "G", "T"]:
        tmp += 1
    else:
        ans = max(ans, tmp)
        tmp = 0

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for s_i in s:
  if s_i in acgt:
    counter+=1
  else:
    ans = max(ans, counter)
    counter=0
    
if counter==len(s):
  print(len(s))
else:
  print(ans)

Submission status: Wrong Answer

Solution code:
origin = input()
lst = ['A', 'T', 'G', 'C']
ans = 0
cnt = 0
for s in origin:
    for ls in lst:
        if s == ls:
            cnt +=1
            break
        if ans <= cnt:
            ans = cnt
        else:
            cnt = 0
print(ans)

Submission status: Wrong Answer

Solution code:
s=input()
S=[s[i] for i in range(len(s))]
A={'A','C','G','T'}
B=[S[i] in A for i in range(len(S))]
max_length=0
print(B)
for i in range(len(B)):
  if B[i]==1:
    count_length=1
    count=i
    while (count+1)<len(B) and B[count+1]==1:
      count_length=1+count_length
      count=1+count
      max_length=max(max_length,count_length)
    max_length=max(max_length,1)
      
print(max_length)

Submission status: Wrong Answer

Solution code:
s=input()
S=[s[i] for i in range(len(s))]
A={'A','C','G','T'}
B=[S[i] in A for i in range(len(S))]
max_length=0
print(B)
for i in range(len(B)):
  if B[i]==1:
    count_length=1
    count=i
    max_length=max(count_length,max_length)
    while (count+1)<len(B) and B[count+1]==1:
      count_length=1+count_length
      count=1+count
      max_length=max(max_length,count_length)
      
print(max_length)