peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
D, N = map(int, input().split())

if D == 0:
  print(N)
elif D == 1:
  print(100 * N)
else:
  print(10000 * N)
# Judge status: Accepted
n=int(input())
c=[[0]*10 for i in range(10)]
for i in range(1,n+1):
  s=str(i)
  c[int(s[0])][int(s[-1])]+=1
ans=0
for i in range(10):
  for j in range(10):
    ans+=c[i][j]*c[j][i]
print(ans)
# Judge status: Accepted
import sys
readline = sys.stdin.buffer.readline

def main():
    A, B = map(int, readline().split())
    S = input()
    if S[:A].isdecimal() and S[A]=='-' and S[A+1:].isdecimal():
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()
# Judge status: Accepted
X,Y = map(int, input().split())
if X % Y != 0:
    print(X)
else:
    print(-1)
# Judge status: Wrong Answer
n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(m)]

if m == 1:
  print("IMPOSSIBLE")

else:
  root = [[] for i in range(n)]
  for a, b in ab:
    root[a-1].append(b-1)
  
  print(root)
  flag = False
  for i in range(len(root)):
    for j in root[i]:
      if n-1 in root[j]:
        flag = True
        break

  print("POSSIBLE" if flag else "IMPOSSIBLE")
# Judge status: Wrong Answer
import heapq
import sys

lines = sys.stdin.readlines()

N, M = [int(n) for n in lines[0].strip().split()]
prices = [-int(n) for n in lines[1].strip().split()]

heapq.heapify(prices)

for _ in range(M):
    price = -heapq.heappop(prices)
    print(price)
    heapq.heappush(prices, -1 * (price // 2))

print(-sum(prices))
# Judge status: Accepted
N,x = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
cnt=0

for i in range(N):
  #print(i,a[i],x)
  if a[i]<=x:
    if i==N-1:
      if x==a[i]:
        cnt += 1
    else:
      x -= a[i]
      cnt += 1
  else:
    break

print(cnt)
# Judge status: Accepted
N = int(input())
X = list(map(int, input().split()))

mid1, mid2 = sorted(X)[N//2-1:N//2+1]
print(*[mid1 if xi>mid1 else mid2 for xi in X], sep="\n")
# Judge status: Accepted
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
if k >= e-a:
  print('Yay!')
else:
  print(':(')
# Judge status: Accepted
n,x,y=map(int,input().split())

ans=[0 for _ in range(n-1)]

for i in range(n-1):
  for j in range(i+1,n):
    t=i+1
    u=j+1
    H=min(abs(u-t),abs(t-x)+1+abs(y-u),abs(t-y)+1+abs(x-u))
    ans[H-1]+=1
    
for l in ans:
  print(l)
# Judge status: Accepted
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

import decimal

def main():
    tax = decimal.Decimal('1.08')
    n = int(input())

    for i in range(1,n+1):
        if int(i*tax)==n:
            print(i)
            exit()
        else:
            continue
    print(":(")

if __name__=="__main__":
    main()
# Judge status: Wrong Answer
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
cnt = Counter(a)
flag = [i for i in cnt.values()]
if len(set(flag)) == 1:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
n,W=map(int,input().split())

s=[tuple(map(int,input().split())) for _ in range(n)]

s.sort()

ans=[s[0]]

for i in range(1,n):
    q=-111
    Max=-100
    for j in range(i):
        if s[i][0]+ans[j][0]<=W and s[i][1]+ans[j][1]>Max :
            q=j
            Max=s[i][1]+ans[j][1]
    ans.append((s[i][0]+ans[q][0],s[i][1]+ans[q][1]))

print(max(ans,key= lambda x : x[1])[1])
# Judge status: Accepted
n = int(input())
count = 0
for i in range(1, n+1):
    if len(str(i)) % 2 == 1:
        count += 1

print(count)
# Judge status: Accepted
S=str(input())
if S=='AAA' or S=='BBB':
  print('No')
else:
  print('Yes')
# Judge status: Accepted
s = input()
t = input()
if len(s) < len(t):
    print('UNRESTORABLE')
    exit()

for i in range(len(s)-len(t)+1)[::-1]:
    # print(s[i])
    for j in range(len(t)):
        if s[i+j] == '?':
            continue
        if s[i+j] != t[j]:
            break
    else:
        ans = s[:i] + t + s[i+len(t):]
        print(ans.replace('?', 'a'))
        break
else:
    print('UNRESTORABLE')
# Judge status: Accepted
A, B = map(int, input().split())
S = input()

if len(S) != A + B + 1:
    print('No')
    exit()

if S[A ] != '-':
    print('No')
    exit()

for i in range(A + B + 1):
    s = S[i]
    if s == '-' and i != A:
        print('No')
        exit()

print("Yes")
# Judge status: Accepted
import itertools
n = int(input())
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
d = divisor(n)
l = float('inf')
for i in range(len(d)):
    l = min(n // d[i] + d[i] - 2,l)
print(l)
# Judge status: Accepted
# Educational_DP_A_Frogs.py

N = int(input())
H = list(map(int, input().split()))
# dp[i]:カエルがiに行くまでのコスト最小値
# dp[i] = min(dp[i-2]+abs(H[i]-H[i-2]), dp[i-1]+abs(H[i]-H[i-1]))

dp = [0 for i in range(N)]
dp[1] = abs(H[0] - H[1])
for i in range(2,N):
    dp[i] = min(dp[i-2] + abs(H[i] - H[i-2]), dp[i-1] + abs(H[i] - H[i-1]))
    # print(dp)
print(dp[N-1])
# Judge status: Accepted
K = int(input())

if K % 2 == 0 or K % 5 == 0:
    print(-1)
    exit()

ans = 0
ai = 0
while True:
    ai = (ai * 10 + 7) % K
    ans += 1
    if ai % K == 0:
        print(ans)
        exit()
# Judge status: Wrong Answer
a,b,c = input().split()
print(a+b[0]+c)
# Judge status: Accepted
import itertools
X = int(input())
P = tuple(map(int, input().split(" ")))
Q = tuple(map(int, input().split(" ")))
comb = list(itertools.permutations(range(1, X+1),X))
a = comb.index(P)
b = comb.index(Q)
print(abs(a-b))
# Judge status: Accepted
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n = int(input())
a = list(map(int, input().split()))

ans = 0
up = None
prev = None
for v in a:
    if prev == v:
        continue
    if prev is not None:
        if up is None:
            up = (prev <= v)
        else:
            if (prev <= v) != up:
                ans += 1
                up = None
    prev = v
print(ans + 1)
# Judge status: Wrong Answer
from collections import deque
n = int(input())
a = list(map(int, input().split()))
odd = deque([])
even = deque([])
even2 = deque([])
for i in a:
    if i % 4 == 0:
        even2.append(i)
    elif i % 2 == 0:
        even.append(i)
    else:
        odd.append(i)
if len(odd)-1 <= len(even2):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
A,B=map(int,input().split())
if (A<=8)and(B<=8):
    print("Yay!")
else:
    print(":(")
# Judge status: Accepted
N = int(input())
syou, amari = divmod(N,15)
print((800 * N) - (syou * 200))
# Judge status: Accepted
n = int(input().strip())
a = list(map(int, input().split()))
b = [(a[i] - (i + 1)) for i in range(n)]
b.sort()
mid = b[n // 2]
ans = 0
for i in range(n):
    ans += abs(b[i] - mid)
print(ans)
# Judge status: Accepted
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N = input()
    result = [abs(int(N[i:i + 3]) - 753)for i in range(len(N) - 2)]
    result.sort()
    print(result[0])


if __name__ == "__main__":
    main()
# Judge status: Accepted
n = int(input())
p = list(map(int,input().split()))
q = list(range(1, n+1)) #正しい昇順リスト
c = 0

if p == q:
  print("YES")

else:
  for i in range(n): #違う箇所の数を探す
    if p[i] != q[i]: #違ったら
      c = c + 1 #cを+1
    if c > 2: #違う箇所が2を超えたら見込みがないので抜ける
      break
  if c == 2: #2なら入れ替え1回で直る
    print("YES")
  else: #それ以外なら無理
    print("NO")
# Judge status: Accepted
n, m = map(int, input().split())
used = [False] * (n+1)
ball = [1] * (n+1)
used[1] = True
for _ in range(m):
    x,y = map(int, input().split())
    ball[x] -= 1
    ball[y] += 1
    if used[x]:
        used[y] = True
    if ball[x] == 0:
        used[x] = False
res = 0
for i in range(1, n + 1):
    if used[i] and ball[i] != 0:
        res += 1
print(res)
#print(ball)
#print(used)
# Judge status: Accepted
n=int(input())
a=[int(i) for i in input().split()]
c=0
for i in range(n):
  c+=(a[i]==i+1)*1
print(['YES','NO'][c<n-2])
# Judge status: Accepted
n,*a=map(int,open(0).read().split())
ans=0
store=1
leaves=sum(a)
for i in range(n+1):
  if a[i]>store:
    ans=-1
    break
  node=min(store,leaves)
  ans+=node
  leaves-=a[i]
  store-=a[i]
  store*=2
print(ans)
# Judge status: Accepted
n=int(input())
a = list(map(int,input().split()))
a.sort()
print(sum(a[n::2]))
# Judge status: Accepted
from collections import Counter

n = int(input())
d = list(map(int, input().split()))
mod = 998244353
if d[0] != 0 or 0 in d[1:]:
    print(0)
else:
    c = Counter(d)
    ans = 1
    for i in range(1, len(c)):
        ans *= c[i-1] ** c[i]
        ans %= mod
    print(ans % mod)
# Judge status: Wrong Answer
#!/usr/bin/env python3
import sys

X = int(input())
ans = 0
if 400 <= X <= 599:
    ans = 8
elif 600 <= X <= 799:
    ans = 7
elif 800 <= X <= 999:
    ans = 6
elif 1000 <= X <= 1199:
    ans = 5
elif 1200 <= X <= 1399:
    ans = 4
elif 1400 <= X <= 1599:
    ans = 3
elif 1600 <= X <= 1799:
    ans = 2
elif 1800 <= X <= 1099:
    ans = 1

print(ans)
# Judge status: Accepted
import math
n=int(input())
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
f=min(a,b,c,d,e)
print(math.ceil(n/f+4))
# Judge status: Accepted
X, Y = map(int, input().split())
if X % Y == 0:
  ans = -1
elif Y % X == 0:
  ans = X * (Y//X + 1)
else:
  ans = X
if ans > 10**18:
  ans = -1
if X == 1 and Y != 1:
  ans = Y + 1
print(ans)
# Judge status: Accepted
a, b, c = map(int, input().split())

if a % 2 == 0 or b % 2 == 0 or c % 2 == 0:
    print(0)
else:
    li_wk = sorted([a, b, c], reverse=True)
    print(li_wk[1] * li_wk[2])
# Judge status: Accepted
n,m = map(int,input().split())
V = [[] for i in range(n+1)]
for i in range(m):
    a,b = map(int,input().split())
    V[a].append(b)
    V[b].append(a)
W = V[1]
z = []
for x in W:
    z.append(V[x])
s = 0
for q in z:
    if n in q:
        s = 1
        break
if s == 1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
# Judge status: Wrong Answer
N=int(input())
print((N//2+1)/N if N%2 else N/2)
# Judge status: Accepted
A,B = map(int,input().split())

for i in range(1,10**5):
  if (A*i)%B==0:
    print(A*i)
    break
# Judge status: Wrong Answer
def main(n: int, m: int):
    ans = n

    m -= n * 2
    ans += m // 4

    print(ans)


if __name__ == "__main__":
    n, m = map(int, input().split())

    main(n, m)
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
c2=0
c4=0
for aa in a:
  if aa%2 == 0:
    if aa%4 == 0:
      c4+=1
    else:
      c2+=1
c0=n-(c2+c4)
cc=2*c4-c0
if c2==1:
  cc-=1
print("Yes" if cc >= 0 else "No")
# Judge status: Accepted
x, k, d = map(int, input().split())

if abs(x) > k * d:
    print(abs(x) - (k * d))
else:
    a = abs(x) // d
    b = abs(x) - (a * d)
    c = k - a
    if c % 2 == 1:
        print(abs(b - d))
    else:
        print(b)
# Judge status: Accepted
n = input()

t_now = 0
x_now = 0
y_now = 0
can_travel = True
for i in range(int(n)):
  next_value = list(map(int,input().split()))
  dt = next_value[0]-t_now
  dist = abs(next_value[1]-x_now)+abs(next_value[2]-y_now)
  if dt < dist:
    can_travel = False
    break
  elif dt%2 != dist%2:
    can_travel = False
    break

if can_travel:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
import math
x = int(input())
print(math.floor(float(360)/float(x)))
# Judge status: Accepted
n =int(input())

s = []

for _ in range(n):
    s.append(input())

dictionary = {}

for i in s:
    if i in dictionary:
        dictionary[i] += 1
    else:
        dictionary[i] = 0

max_val = max(dictionary.values())
keys_of_max_val = []

for key in dictionary:
    if dictionary[key] == max_val:
        keys_of_max_val.append(key)

keys_of_max_val.sort()

for ans in keys_of_max_val:
    print(ans)
# Judge status: Accepted
from math import gcd
n = int(input())
t = int(input())
for i in range(n-1):
    tt = int(input())
    t = t*tt//gcd(t, tt)
print(t)
# Judge status: Accepted
n,k = map(int,input().split())
p = list(map(int,input().split()))

num = sum(p[:k])
ans = num/2 + 0.5*k
for i in range(k,n):
    num += p[i] - p[i-k]
    ans = max(ans,num/2 + 0.5*k)
print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))
cnt = 0
m = 10**18

for Ai in A:
    if Ai<0:
        cnt += 1
    
    m = min(m, abs(Ai))

if cnt%2==0:
    print(sum(abs(Ai) for Ai in A))
else:
    print(sum(abs(Ai) for Ai in A)-2*m)
# Judge status: Accepted
a,b,c = map(int,input().split())

kaisu = b // a

if kaisu >= c:
  print(c)
else:
  print(kaisu)
# Judge status: Accepted
import sys
import math  # noqa
import bisect  # noqa
import queue  # noqa


def input():
    return sys.stdin.readline().rstrip()


def main():
    _ = int(input())
    S = input()

    if len(set(S)) == 1:
        return print(0)

    w = S.count('.')
    b = 0
    ans = w
    for s in S:
        if s == '#':
            b += 1
        else:
            w -= 1
        ans = min(ans, b + w)
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
n,m = map(int,input().split())
A = list(map(int,input().split()))
A = sorted(A,reverse=True)
k = sum(A)/(4*m)
for a in A[:m]:
    if a<k:
        print('No')
        exit()
print('Yes')
# Judge status: Wrong Answer
n, w = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(n)]

dp = [[0]*w for _ in range(n)]
for i in range(n):
    for j in range(w):
        if j >= wv[i][0]:
            dp[i][j] = max(dp[i-1][j], wv[i][1] + dp[i-1][j-wv[i][0]+1])
        else:
            dp[i][j] = max(dp[i][j], dp[i-1][j])

print(dp[-1][-1])
# Judge status: Accepted
N ,Q = map(int, input().split())
S = list(input())
ans = [0]*N
jdg = S[0]
cnt = 0
for i in range(1,N):
    if jdg == "A" and S[i] == "C":
        cnt += 1
        ans[i] = cnt
        jdg = S[i]
    else:
        jdg = S[i]
        ans[i] = cnt

for i in range(Q):
    l, r = map(int, input().split())
    print(ans[r-1]-ans[l-1])
# Judge status: Wrong Answer
n, m = map(int, input().split())
print((n + (m - n * 2) // 4, n * (m // 2))[n * 2 >= m])
# Judge status: Accepted

n,l = map(int,input().split())
t = []
ans = []
w = []
diff = []

for i in range(n):
    t.append(l+(i+1)-1)

for i in range(n):
    ans = t.copy()
    del ans[i]
    w.append(sum(ans))
    diff.append(abs(sum(t)-sum(ans)))

num = diff.index(min(diff))

print(w[num])
# Judge status: Wrong Answer
x, s = *open(0),
print(x)
print(s)
n, a, b = map(int, x.rstrip().split())

p = 0
wp = 0

for char in s:
    if char == 'c' or p >= a+b:
        print('No')
        continue
    if char == 'a':
        p += 1
        print('Yes')
        continue
    if wp < b:
        p += 1
        wp += 1
        print('Yes')
    else:
        print('No')
# Judge status: Accepted
a,b,c=map(int,input().split())
if b<(a*c):
  print(b//a)

else:
  print(c)
# Judge status: Wrong Answer
N = int(input())

result = N * (N - 1)
result = result * (10 ** (N - 2))
result = result % (10 ** 9 + 7)

print(result)
# Judge status: Accepted
n,k=map(int,input().split())
a=list(map(int,input().split()))
[print("Yes" if a[k+i]>a[i] else "No") for i in range(n-k)]
# Judge status: Wrong Answer
a,b = map(int,input().split())

if a + b > 24:
    print(a + b - 24)
else:
    print(a + b)
# Judge status: Wrong Answer
S = input()
Z = 753
for i in range(3, len(S)+1):
  s = int(S[i-3:i])
  a = abs(753-s)
  if Z-a>0:
    Z = a
print(a)
# Judge status: Wrong Answer
y = 0
x = int(input())
for i in range(1000**2+1):
    x2 = i**2
    if x2 <= x:
        y = x2
print(y)
# Judge status: Accepted
from collections import Counter
mod=10**9+7 
input()
s=list(input())
c=Counter(s)
ans=1
for i in c.values():
    ans*=(i+1)
    ans%=mod
ans-=1
ans%=mod
print(ans)
# Judge status: Wrong Answer
#abc087 c
n=int(input())
a1=[0]*(n+1)
a2=[0]*(n+1)
for i in range(2):
    x=list(map(int,input().split()))
    if i==0:
        for j,k in enumerate(x):
            a1[j+1]=a1[j]+k
    else:
        for j,k in enumerate(x):
            a2[j+1]=a2[j]+k


ans=0
for i in range(1,n):
    sum=a1[i]+a2[n]-a2[i-1]
    ans=max(ans,sum)
print(ans)
# Judge status: Wrong Answer
n = int(input())
a = [int(i) for i in input().split()]

if n % 2 == 0:
    lis1 = a[::2]
    lis2 = a[::-2]
    ans = lis2 + lis1
else:
    lis1 = a[::-2]
    lis2 = a[1::2]
    ans = lis1 + lis2
print(ans)
# Judge status: Accepted
N = int(input())
dictionary = {}
for i in range(N):
    S = input()
    if S not in dictionary.keys():
        dictionary[S] = 1
    else:
        dictionary[S] += 1


value_max = max(dictionary.values())

max_list = []
for k, v in dictionary.items():
    if v == value_max:
        max_list.append(k)

max_list.sort()
for i in max_list:
    print(i)
# Judge status: Wrong Answer
k,a,b=map(int,input().split())
cnt=1
yen=0

if b<a+2:
    print(k+1)

else:
    if k>=a+1:
        k-=a+1
        cnt+=b
        q,modulo=divmod(k,a+2)
        cnt+=q*b+modulo
        print(cnt)
    else:
        print(k)
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))
mean = sum(a) / len(a)
#print(mean)
tar = round(mean)
#print(tar)
score = 0
for x in a:
    score += (x-tar)*(x-tar)
print(score)
# Judge status: Wrong Answer
n, m = map(int, input().split())

s = [0] * n
s[0] = 1
b = [1] * n
for i in range(m):
    x, y = map(int, input().split())
    b[x-1] -= 1
    b[y-1] += 1

    s[x-1] = int(b[x-1] != 0)
    s[y-1] = int(s[x-1] == 1)

ans = 0
for i in range(n):
    if s[i] and b[i]:
        ans += 1

print(ans)
# Judge status: Wrong Answer
N=int(input())
S=input()
ans=0
for i in range(N+1):
  bns=0
  dp=[0]*26
  bp=[0]*26
  a=S[:i]
  b=S[i:]
  a=sorted(a)
  b=sorted(b)
  for j in range(len(a)):
    dp[ord(a[j])-97]+=1
  for k in range(len(b)):
    bp[ord(b[k])-97]+=1
  for l in range(26):
    bns+=min(dp[l],bp[l])
  ans=max(ans,bns)
print(ans)
# Judge status: Accepted
a, b = map(int, input().split())
if a <= 8 and b <= 8:
  print("Yay!")
else:
  print(":(")
# Judge status: Wrong Answer
n = int(input())
w = sorted([ int(x) for x in input().split() ])
ans = sum(w)
l, r = 0, sum(w)
for i in range(n):
    l += w[i]
    r -= w[i]
    ans = min(ans, abs(l-r))

print(ans)
# Judge status: Wrong Answer
n = int(input())
x = 1
while x * x<= n:
    x += 1
print(x*x)
# Judge status: Accepted
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

h1,m1,h2,m2,k = mi()

s = 60 * h1 + m1
f = 60 * h2 + m2

ans = f-s-k

print(ans)
# Judge status: Accepted
#　149D
n, k = map(int, input().split())
point={}
point['s'],point['p'],point['r'] = map(int, input().split())
s = input()

ans =0
before = [0]*k
for i in range(len(s)):
    if i >= k:
        if (s[i] == s[i-k]) & (before[i%k]==1):
            before[i%k] = 0
        else:
            ans += point[s[i]]
            before[i%k] = 1
    else:
        ans += point[s[i]]
        before[i%k] = 1
print(ans)
# Judge status: Wrong Answer
x, a, b = map(int, input().split())
print("delicious" if a + b >= x else "safe" if x >= a else "dangerous")
# Judge status: Accepted
n,m=map(int,input().split())
k=[0]*n
for i in range(m):
  a,b=map(int,input().split())
  k[a-1]+=1
  k[b-1]+=1
for i in range(n):
  print(k[i])
# Judge status: Wrong Answer
u = input()
for i in range(len(u)):
  for j in range(i,len(u)):
    if u[i]==u[j]:
      print("no")
      exit()
print("yes")
# Judge status: Wrong Answer
def resolve():
    A, B, C = list(map(int, input().split()))
    ans = ''
    if A % 2 == 0 or B % 2 == 0 or C % 2 == 0:
        ans = 0
    else:
        ans = B * C

    print(ans)
    return


resolve()
# Judge status: Accepted
s = input()

N,W,S,E = s.count("N"),s.count("W"),s.count("S"),s.count("E")

cond = 1

if N == 0 and S > 0:
	cond = 0
if S == 0 and N > 0:
	cond = 0
if W == 0 and E > 0:
	cond = 0
if E == 0 and W > 0:
	cond = 0

if cond:
	print("Yes")
else:
	print("No")
# Judge status: Accepted
import itertools
N = int(input())
S = input()
ls = list(S)

nr = len([r for r in S if r == 'R'])
nb = len([b for b in S if b == 'B'])
ng = len([g for g in S if g == 'G'])

ALL = nr * nb * ng
count = 0

RGBs = list(itertools.permutations(['R', 'G', 'B'], 3))

for i in range(N):
  for j in range(N-i*2):
    if (S[j], S[j+i], S[j+i*2]) in RGBs:
      count += 1
      
print(ALL - count)
# Judge status: Accepted
s = raw_input()
a = set(list('ACGT'))
j = 0
i = 0
r = 0
while( j < len(s)):
	if s[j] not in a:
		j += 1
		i = j 
	else:
		while(j < len(s) and s[j] in a): j+=1
		r = max(r, j - i )
		i = j
print r
# Judge status: Accepted
import bisect,collections,copy,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())
def main():
    n = I()
    a = LI()

    acc = 0
    for i in a:
        acc ^= i
    
    ans_lst = []
    for i in a:
        ans = acc^i
        ans_lst.append(ans)

    print(*ans_lst)
main()
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))

l = sum(a)
half = 0
tmp=a[0]
while tmp<l/2:
    half+=1
    tmp+=a[half]
    
    
print(int(min(tmp-l/2,abs(tmp-a[half]-l/2))*2))
# Judge status: Accepted
N = int(input())
C, S, F = [], [], []
for _ in range(N - 1):
    c, s, f = map(int, input().split())
    C.append(c)
    S.append(s)
    F.append(f)

for i in range(N):
    ans = 0
    for j in range(i, N - 1):
        if ans < S[j]:
            ans = S[j]
        else:
            ans = ((ans + F[j] - 1) // F[j]) * F[j]

        ans += C[j]

    print(ans)
# Judge status: Accepted
import math
from functools import reduce
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
N = int(input())
T = [int(input()) for i in range(N)]
print(lcm_list(T))
# Judge status: Accepted
a = list(map(int,input()))
h = []

for i in range(1,2**3):
    total = a[0]
    h.clear()
    for j in range(3):
        if ((i >> j) & 1):
            total += a[j+1]
            h.append('+')
        else:
            total -= a[j+1]
            h.append('-')
    if total == 7:
        break
for i in range(3):
    print(str(a[i])+h[i],end="")
print(str(a[3])+"=7")
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))
cnt = 0
for i in range(n - 2):
    if (p[i] < p[i + 1] and p[i + 1] < p[i + 2]) or (p[i] > p[i + 1] and p[i + 1] > p[i + 2]):
        cnt += 1
print(cnt)
# Judge status: Wrong Answer
s = input().split()
print("".join(s))
# Judge status: Wrong Answer
import math
n = int(input())
for i in range(n, 1, -1):
    if float.is_integer(math.sqrt(i)) == True:
        print(i)
        exit()
# Judge status: Accepted
a,b,x = map(int,input().split())
if a+b >= x and x-a >= 0:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
n,m=map(int,input().split())
s1=[input() for _ in range(n)]
s2=[input() for _ in range(m)]
ans='No'
for i in range(n-m+1):
  for j in range(n-m+1):
    flg=0
    for k in range(m):
      if s1[j+k][i:i+m]==s2[k]:
        flg+=1
    if flg==m:
      ans='Yes'
print(ans)
# Judge status: Accepted
n = int(input())
cnt = [[0] * 10 for i in range(10)]
for i in range(1,n+1):
    cnt[int(str(i)[0])][int(str(i)[-1])] += 1
    
ans = 0
for i in range(10):
    for j in range(10):
        ans += cnt[i][j] * cnt[j][i]
print(ans)
# Judge status: Accepted
N, K = map(int, input().split())
h = []
for i in range(N):
    h.append(int(input()))

h.sort()

m = h[-1] #現時点での最大

for i in range(N-K+1):
    x = h[K+i-1] - h[i]
    if m > x:
        m = x
print(m)
# Judge status: Wrong Answer
import math
x = int(input())
s = int(math.ceil(x**(0.5)))
s = s*(s+1)//2
if  s < x: print(int(math.ceil(x**(0.5))+1))
else: print(int(math.ceil(x**(0.5))))
# Judge status: Accepted
A, B =map(int, input().split())
num_palin = [0] * (B+1)
for i in range(1,B+1):
    if str(i) == str(i)[::-1]:
        num_palin[i] = num_palin[i-1] + 1
    else:
        num_palin[i] = num_palin[i-1]
print(num_palin[B]-num_palin[A-1])
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))
ans1 = sum(A) - 2 * min(A)
for i in range(N - 1):
    if A[i] < 0:
        A[i] *= -1
        A[i + 1] *= -1
    ans2 = sum(A)
ans = max(ans1, ans2)
print(ans)
# Judge status: Accepted
x = int(input())
ans = x // 11 * 2
x %= 11
l = [0] + [1] * 6 + [2] * 5
ans += l[x]
print(ans)