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:
def main():
    s = input()
    l = ['A', 'G', 'T', 'C']
    ans = 0
    for j in range(len(s)):
        cnt = 0
        for i in range(j, len(s)):
            if s[i] in l:
                cnt += 1
        ans = max(ans, cnt)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():

    s = input()
    l = ['A', 'G', 'T', 'C']
    ans = 0
    for j in range(len(s)):
        cnt = 0
        for i in range(j, len(s)):
            if s[i] in l:
                cnt += 1
            else:
                ans = max(ans, cnt)
                break
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    s = input()
    l = ['A', 'G', 'T', 'C']
    cnt = 0
    ans = 0
    for j in range(len(s)):
        for i in range(j, len(s)):
            if not s[i] in l:
                ans = max(ans, cnt)
                cnt = 0
                break
            cnt += 1
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
s=input()
l=len(s)
ans=0
for i in range(l):
  for j in range(1,l-i+1):
    t=s[i:i+j]
    for k in range(j):
      if t[k]=='A' or t[k]=='C' or t[k]=='G' or t[k]=='T':
        continue
      else:
        break
    else:
      ans=max(ans,j)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S=input()
cnt=0
ans=0
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:
def ABC106():
    def make_divisors(n):
        divisors = []
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                divisors.append(i)
                if i != n // i:
                    divisors.append(n // i)
        # divisors.sort()
        return divisors
    N = I()
    ans = 0
    for i in range((N+1)//2):
        cur = i*2+1
        if len(make_divisors(cur))==8:
            ans += 1
    print(ans)
    return

def ABC122():
    S = SI()
    ans = 0
    cur = 0
    d = {"A","C","G","T"}
    for s in S:
        if s in d:
            cur += 1
        else:
            ans = max(ans,cur)
            cur = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math,random
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    ABC122()

"""

"""

Submission status: Wrong Answer

Solution code:
target = set(["A", "C", "G", "T"])

S = list(input())

tmp = 0
ans = 0
for i in S:
    print(i)
    if i in target:
        print("aaa")
        tmp+=1
    else:
        ans = max(tmp,ans)
        tmp = 0

ans = max(tmp,ans)
print(ans)

Submission status: Wrong Answer

Solution code:
target = set(["A", "C", "G", "T"])

S = list(input())

tmp = 0
ans = 0
for i in S:
    if i in target:
        tmp+=1
    else:
        ans = max(tmp,ans)
        tmp = 0

print(ans)

Submission status: Wrong Answer

Solution code:
target = set(["A", "C", "G", "T"])

S = list(input())

tmp = 0
ans = 0
for i in S:
    if i in target:
        tmp+=1
    else:
        ans = max(tmp,ans)

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
n = len(s)

ret = 0
for i in range(n):
    for j in range(i + 1, n):
        # [i,j)
        t = s[i:j]
        if all(c in 'ACGT' for c in t):
            ret = max(ret, len(t))

print(ret)

Submission status: Wrong Answer

Solution code:
s = input()
l = 0
max_num = 0

for str in s:
    if str in 'ATCG':
        l += 1
    else:
        max_num = max(max_num, l)
        l = 0
print(max_num)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
len_li = [0]
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
    else:
        len_li.append(cnt)
        cnt = 0 
print(max(len_li))

Submission status: Wrong Answer

Solution code:
S = input()
ans = [0] * (len(S) + 1)
for i in range(len(S)):
  if S[i] not in "ATCG": continue
  ans[i+1] += ans[i]
print(max(ans))

Submission status: Wrong Answer

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

print(max(li))

Submission status: Wrong Answer

Solution code:
s = input()
res = 0
cnt = 0
ATGC = ['A', 'T', 'G', 'C']
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:
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def roundUp(a, b):
        return -(-a // b)

    @staticmethod
    def toUpperMultiple(a, x):
        return Math.roundUp(a, x) * x

    @staticmethod
    def toLowerMultiple(a, x):
        return (a // x) * x

    @staticmethod
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

    @staticmethod
    def sign(n):
        if n == 0:
            return 0
        if n < 0:
            return -1
        return 1

    @staticmethod
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True

    @staticmethod
    def divisor(n):
        i = 1
        table = []
        while i * i <= n:
            if n % i == 0:
                table.append(i)
                table.append(n // i)
            i += 1
        table = list(set(table))
        return table


class PriorityQueue:
    def __init__(self, l=[]):
        self.__q = l
        heapq.heapify(self.__q)
        return

    def push(self, n):
        heapq.heappush(self.__q, n)
        return

    def pop(self):
        return heapq.heappop(self.__q)

    def list(self):
        return self.__q

    def length(self):
        return len(self.__q)


sys.setrecursionlimit(1000000)
MOD = int(1e09) + 7
INF = int(1e30)


def main():
    # sys.stdin = open("Sample.txt")
    S = Scanner.string()
    ans = 0
    N = len(S)
    for i in range(N-1):
        for j in range(i, N):
            cnt = 0
            for s in S[i:j+1]:
                if not (s == "A" or s == "G" or s == "C" or s == "T"):
                    cnt = -1
                    break
                cnt += 1
            ans = max(ans, cnt)
    print(ans)
    return


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

S = input().strip()
a = ['A', 'T', 'G', 'C']

ans = 0
j = []
for i in range(len(S)):
  j = i
  count = 0
  while True:
    if j >= len(S):
      break
    if S[j] in a:
      count += 1
      j += 1
    else:
      ans = max(ans, count)
      break
  
print(ans)

Submission status: Wrong Answer

Solution code:
import re

S = input()

m = re.search(r"[ACGT]+", S)
if m:
    print(len(m.group()))
else:
    print(0)

Submission status: Wrong Answer

Solution code:

s = input()
n = len(s)
ans = 0
count = 0

for i in range(len(s)):
    for j in range(i,n):
        if all("ACGT".count(c) == 1 for c in s[i:j + 1]):
            ans = max(ans, j +1)


print(ans)

Submission status: Wrong Answer

Solution code:

s = input()
ans = 0
count = 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 ans <= count:
            ans = count
            count = 0

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
ans = ''
t = ''
acgt = 'ACGT'
for s in S:
    if (s in acgt):
        t += s
    else:
        if (len(ans) < len(t)):
            ans = t

if (len(ans) < len(t)):
    ans = t
print(ans)

Submission status: Wrong Answer

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

maxc = 0
c = 0

for i in range(N):
    if S[i] in {'A', 'T', 'G', 'C'}:
        c += 1
    else:
        maxc = max(maxc, c)
        c = 0

print(maxc)

Submission status: Wrong Answer

Solution code:
S = input()

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

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()

l = []

for i in range(0,len(S)):
    if(S[i] == 'A' or S[i] == 'G' or S[i] == 'C' or S[i] == 'T'):
        l.append(i)
        
##print(l)
if(len(l) == 0):
    print(0)
else:   
    count = 1
    max = 1

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

Submission status: Wrong Answer

Solution code:
S = input()

l = []

for i in range(0,len(S)):
    if(S[i] == 'A' or S[i] == 'G' or S[i] == 'C' or S[i] == 'T'):
        l.append(i)
        
print(l)
if(len(l) == 0):
    print(0)
else:   
    count = 1
    max = 1

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

Submission status: Wrong Answer

Solution code:
S = input()

l = []

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

if(len(l) == 0):
    print(0)
count = 1
max = 1

for i in range(0,len(l)-1):
    if(l[i]+1 == l[i+1]):
        count += 1
        max = count
    else:
        max = count
        count = 0


print(max)

Submission status: Wrong Answer

Solution code:
S = input()

l = []

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

if(len(l) == 0):
    print(0)
count = 1
max = 0

for i in range(0,len(l)-1):
    if(l[i]+1 == l[i+1]):
        ##print(count)
        count += 1
        max = count
    else:
        max = count
        count = 0


print(max)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    S = input()
    result = 0
    cnt = 0
    for s in S:
        if s in ['A', 'G', 'C', 'T']:
            cnt += 1
            continue
        if result < cnt: result = cnt
        cnt = 0
    print(result)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()

mx  = 0
n = len(s)
kensa = ["A", "C", "G", "T"]

for i in range(n):
    for j in range(i,n-1):
        mj = s[i:j+1]
        bl = True
        for l in range(len(mj)):
            if mj[l] not in kensa:
                bl = False
                break
        if bl and mx<len(mj):
           mx = len(mj)

print(mx)

Submission status: Wrong Answer

Solution code:
s = input()

mx  = 0
n = len(s)
kensa = ["A", "C", "G", "T"]

for i in range(n):
    for j in range(i,n-1):
        mj = s[i:j+1]
        bl = True
        for l in range(len(mj)):
            if mj[l] not in kensa:
                bl = False
                break
        if bl & mx<len(mj):
           mx = len(mj)

print(mx)

Submission status: Wrong Answer

Solution code:
S = list(input())
N = len(S)
M = ["A","G" ,"C" ,"T"]

cnt = 0
Ans = 0
for i in range(N):
    if S[i] in M:
        cnt += 1
        Ans = max(Ans, cnt)
    else:
        Ans = max(Ans, cnt)
print(Ans)

Submission status: Wrong Answer

Solution code:
S = list(input())
N = len(S)
M = ["A","G" ,"C" ,"T"]

cnt = 0
Ans = 0
for i in range(N):
    if S[i] in M:
        cnt += 1
    else:
        Ans = max(Ans, cnt)
print(Ans)

Submission status: Wrong Answer

Solution code:
S=list(input())
p=0;q=0
for i in range(len(S)):
  for j in range(i,len(S)):
    if S[j]=="A" or S[j]=="C" or  S[j]=="G" or S[j]=="T":
      q=q+1
      p=max(p,q)
    else:
      q=0
      break
print(p)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# https://atcoder.jp/contests/abc122/tasks/abc122_b

import re
s = input()
m = re.search(r"([ACGT]+)", s)
if m:
    print(len(m.group(1)))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
s = input()

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
s = input()
lst = list(s)
cnt = 0
ans = 0
for i in s:
    if i in "ATGC":
        cnt += 1
    else:
        ans = max(cnt,ans)
        cnt = 0
print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    S = input()
    result = 0
    for i in range(len(S)):
        for j in range(len(S)):
            if len(set(list(S[i:j])) - set(['A', 'C', 'G', 'T'])) == 0:
                if result < len(list(S[i:j])):
                    result = len(list(S[i:j]))
    print(result)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    s = input()

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

    count = 0
    tmp = 0

    for i in range(len(s)):
        if s[i] in ok_str:
            tmp += 1
        else:
            if count < tmp:
                count = tmp
            tmp = 0

    print(count)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
s = input()
most = 0
acgt = ["A", "C", "G", "T"]
point = 0
for i in range(len(s)):
    if s[i] in acgt:
        point += 1
    else:
        if point > most:
            most = point
        point = 0
print(most)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=str(input())
cnt=0
result=0
for i in range(len(s)):
    if s[i] in ["A","T","G","C"]:
        cnt += 1
    else:
        if result <= cnt:
            result=cnt
            cnt=0
        else:
            cnt=0
print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()

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

print(ans)

Submission status: Wrong Answer

Solution code:
s = [x for x in list(map(str, input()))]

ans = 0
for x in s:
    if x == 'A' or x == 'T' or x == 'G' or x == 'C':
        ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()

flag = False
count = 0
ans = 0
check = ['A', 'T', 'C', 'G']
for i in range(len(s)):
  flag = False
  for j in range(4):
    if s[i] == check[j]:
      flag = True
      break
  if flag:
    count += 1
  else:
    if count > ans:
      ans = count
      count = 0
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = 0
last_ans = 0
for i in S:
  if i in ATGC:
    last_ans += 1
  else:
    ans = max(ans, last_ans)
    last_ans = 0
    
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=list(input())
d=["A","G","C","T"]
a=[]
b=[]
x=[]
for i in range(len(s)):
    a.append(s[i:])
for j in a:
    for k in range(len(j)-1):
        b.append(j[:-k-1])
ans=a+b
print(ans)
for i in ans:
    if set(i) <= set(d):
        x.append(len(i))
    else:
        pass
if x:
  print(max(x))
else:
  print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = list(input())
ACGT = set(["A","C","G","T"])
ans = 0
acgt_length = 0

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

Submission status: Wrong Answer

Solution code:
gene = ["A","T","G","C"]
def is_gene(i):
    if i in gene:
        return True
    else:
        return False

S = list(input())

ans = 0
tmp = 0

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

print(ans)

Submission status: Wrong Answer

Solution code:
gene = ["A","T","G","C"]
def is_gene(i):
    if i in gene:
        return True
    else:
        return False

S = input()

ans = 0
tmp = 0

for i in S:
    if is_gene(i):
        tmp += 1
    else:
        ans = max(ans,tmp)
        tmp = 0

print(ans)

Submission status: Wrong Answer

Solution code:
x = input()
i = 0
ans = 0
for xi in x:
  if xi == 'A' or xi == 'T' or xi == 'G' or xi == 'C':
    i = i + 1
  else:
    if ans < i:
      ans = i
    i = 0
print(ans)

Submission status: Wrong Answer

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


def read_list():
    return list(read_values())


def main():
    S = input()
    res = 0
    tmp = 0
    for s in S:
        if s in ("A", "T", "C", "G"):
            tmp += 1
        else:
            res = max(res, tmp)
            tmp = 0
    print(res)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def ABC122B():
    S = input()
    target = ['A', 'G', 'C', 'T']
    flag = False
    cnt = 0
    for s in list(S):
        if s in target:
            cnt += 1
            if flag == False:flag = True
        if flag == True and s not in target:
            break
    print(cnt)

ABC122B()

Submission status: Wrong Answer

Solution code:
s = list(input())
#print(s)
x = []
for i in s:
    if i in ('A' 'C' 'G' 'T'):
        x.append(1)
    else:
        x.append(0)
#print(x)

z = len(x)
y = [0]
a = 1
for j in range(z):
    if x[j] == 1:
        if x[j-1] == 1:
            a += 1
            if j == z-1:
                y.append(a)
        else:
            y.append(a)
            a = 1
    else:
        if x[j-1] == 1:
            y.append(a)
            a = 1
        else:
            a = 1
#print(y)
print(max(y))

Submission status: Wrong Answer

Solution code:
s = list(input())
#print(s)
x = []
for i in s:
    if i in ('A' 'C' 'G' 'T'):
        x.append(1)
    else:
        x.append(0)
#print(x)

y = [0]
a = 1
for j in range(len(x)):
    if x[j] == 1:
        if x[j-1] == 1:
            a += 1
        else:
            y.append(a)
            a = 1
    else:
        
        if x[j-1] == 1:
            y.append(a)
            a = 1
        else:
            a = 1
#print(y)
print(max(y))

Submission status: Wrong Answer

Solution code:
s = input()

count = 0
result = 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
  if result < count:
      result = count
      count =0

if result < count:
  result = count

print(result)

Submission status: Wrong Answer

Solution code:
s = input()

count = 0
result = 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
  if result < count:
      result = count
      count =0

if count > 0:
  result = count

print(result)

Submission status: Wrong Answer

Solution code:
s = input()

count = 0
result = 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 result < count:
      result = count
      count =0

print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

atcg = set('ATCG')

s = sys.stdin.readline().rstrip()
l = len(s)

def main():
    t = s + '$'
    res = 0
    cnt = 0
    for i in range(l):
        if t[i] in atcg:
            cnt += 1
        else:
            res = max(res, cnt)
            cnt = 0
    return res

if __name__ == '__main__':
    ans = main()
    print(ans)

Submission status: Wrong Answer

Solution code:

s = list(input())
ans = 0
tmp = []

for i in range(len(s)):
    for j in range(1,len(s)-i):
        tmp = s[i:(-1)*j]

#        print(tmp)
#        print(tmp.count("A"))
#        print(tmp.count("C"))
#        print(tmp.count("G"))
#        print(tmp.count("T"))

        if tmp.count("A") + tmp.count("C") + tmp.count("G") + tmp.count("T") == len(tmp):
            if len(tmp) >= ans:
                ans = len(tmp)

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
ACGT = ["A","C","G","T"]
 
ans = 0 
ans_lis = [0]
 
for i in range(len(S)):
    if S[i] in ACGT:
        ans = ans + 1 
    elif S[i] not in ACGT:
        ans_lis.append(ans)
        ans = 0 
 
print(max(ans_lis))

Submission status: Wrong Answer

Solution code:
a = 'ATCG'
s = input()
ans = 0
cnt = 0
for i in range(len(s)):
    if s[i] in a:
        cnt += 1
    else :
        if cnt > ans:
            ans= cnt
        cnt = 0
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
import math
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

s = ns()
ans = 0
c = 0
acgt = ["A", "C", "G", "T"]
for si in s:
    if si in acgt:
        c += 1
    else:
        ans = max(c, ans)
        c = 0
print(ans)

Submission status: Wrong Answer

Solution code:
s=input()
ans=0
cnt=0
for i in s:
    if 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().strip()
ans = 0
tmp = 0
for _, x in enumerate(s):
    if x == "A" or x == "C" or x == "G" or x == "T":
        tmp += 1
    else:
        ans = max(ans, tmp)
        tmp = 0
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(max(ans,count))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import re
s = input()

ans = ""
tmp_ans = ""
for i in range(len(s)):
    if re.fullmatch(r"[ATGC]", s[i]):
        tmp_ans += s[i]
    else:
        if len(ans) < len(tmp_ans):
            ans = tmp_ans
        tmp_ans = ""

print(len(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
S = list(str(input()))

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

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

Submission status: Wrong Answer

Solution code:
S = input()
tmp=0
ans=0
for s in S:
  if s in 'ACGT':
    tmp+=1
  elif s not in 'ACGT':
    ans = max(ans,tmp)
    tmp=0
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
tmp=''
ans=0
for s in S:
  if s in 'ACGT':
    tmp+=s
  else:
    ans = max(ans,len(tmp))
    tmp=''
print(ans)

Submission status: Wrong Answer

Solution code:
a=str(input())
count=0
ans=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:
        ans=max(ans,count)
        count=0
print(ans)

Submission status: Wrong Answer

Solution code:
a=str(input())
count=0
ans=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:
        ans=max(ans,count)
        count=0
print(ans)

Submission status: Wrong Answer

Solution code:
a=str(input())
count=0
ans=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:
        ans=max(ans,count)

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
code = ["A","C","G","T"]
mask = [None] * len(S)
ans = 0
temp = 0

for el in S:
    if el in code:
        temp += 1
    else:
        ans = max(ans,temp)
        temp = 0
    
print(ans)