Harryxun/stf_run huggingface dataset:
def main():
  a, b = map(int, input().split())
  s = input()
  for i in range(1, len(s)+1):
    if i == a+1:
      if s[i] != '-':
       	return False
    else:
      if s[i] == '-':
        return False
  return True

if __name__ == '__main__':
  if main():
    print('Yes')
  else:
    print('No')

### FIXED CODE ###

def main():
  a, b = map(int, input().split())
  s = input()
  for i in range(len(s)):
    if i == a:
      if s[i] != '-':
       	return False
    else:
      if s[i] == '-':
        return False
  return True
 
if __name__ == '__main__':
  if main():
    print('Yes')
  else:
    print('No')
S = int(input())
if S = "Sunny":
  print("Cloudy")
elif S = "Cloudy":
  print("Rainy")
elif S ="Rainy":
  print("Sunny")
  

### FIXED CODE ###

S = input()
if S == "Sunny":
  print("Cloudy")
elif S == "Cloudy":
  print("Rainy")
elif S == "Rainy":
  print("Sunny")
n,m = map(int,input().split())
s = set()
t = set()
for i in range(m):
  a,b = map(int,input().split())
  if a == 1 and b != n:
    s.add(b)
  if a != 1 and b == n:
    t.add(a)

if len(a&b) > 0:
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')

### FIXED CODE ###

n,m = map(int,input().split())
s = set()
t = set()
for i in range(m):
  a,b = map(int,input().split())
  if a == 1 and b != n:
    s.add(b)
  if a != 1 and b == n:
    t.add(a)
 
if len(s&t) > 0:
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')
print(int(input()/3**3))

### FIXED CODE ###

L = int(input())
print((L/3)**3)
import heapq
N, M = map(int,input().split())
L = [[] for _ in range(M)]
for _ in range(N):
    A, B = map(int,input().split())
    L[A-1].append(-B)
Q = []
ans = 0
for i in range(M):
    for j in L[i]:
        heapq.heappush(Q, j)
    ans -= heapq.heappop(Q)
    
print(ans)

### FIXED CODE ###

import heapq
N, M = map(int,input().split())
L = [[] for _ in range(M)]
for _ in range(N):
    A, B = map(int,input().split())
    try:
        L[A-1].append(-B)
    except:
        pass
Q = []
ans = 0
for i in range(M):
    for j in L[i]:
        heapq.heappush(Q, j)
    try:
        ans -= heapq.heappop(Q)
    except:
        pass
print(ans)
n = int(input())
a = [int(input()) for i in range(N)]

for j in a:
    if j >= max(a):
        print(sorted(a)[-2])
    else:
        print(max(a))

### FIXED CODE ###

n = int(input())
a = [int(input()) for i in range(n)]
b = a[:]
b.sort()

if b[n-1] == b[n-2]:
    for _ in range(n): 
        print(b[n-1])
else:
    for j in a:
        if j >= b[n-1]:
            print(b[n-2])
        else:
            print(b[n-1])
n = int(input())
s = int(input())

flag = False

if s == n:
  print(n+1)
  exit()

def chk(b, n):
  if n//b == 0:
    return n
  else:
    return chk(b,n//b) + n%b

for b in range(2, int(n**0.5)+1):
  if chk(b, n) == s:
    print(b)
    flag = True
    exit()

for i in range(int(n**0.5), 0, -1):
  b = (n-s)//i + 1
  if chk(b, n) == s:
    print(b)
    flag = True
    exit()

if flag == False:
  print(-1)

### FIXED CODE ###

n = int(input())
s = int(input())

flag = False
if s > n or (n//2)+1<s<n:
  print(-1)
  exit()
  
if s == n:
  print(n+1)
  exit()

def chk(b, n):
  if n//b == 0:
    return n
  else:
    return chk(b,n//b) + n%b

for b in range(2, int(n**0.5)+1):
  if chk(b, n) == s:
    print(b)
    flag = True
    exit()

for i in range(int(n**0.5), 0, -1):
  b = (n-s)//i + 1
  if chk(b, n) == s:
    if b > 1:
      print(b)
      flag = True
      exit()

if flag == False:
  print(-1)
print {'ABC':'ARC', 'ARC', 'ABC'}[raw_input()]

### FIXED CODE ###

print 'ARC' if raw_input() == 'ABC' else 'ABC'
N = int(input())
p = 1
for i in range(1, N ; 1):
    p *= i
print(p % 1000000007)

### FIXED CODE ###

import math
N = int(input())
print(math.factorial(N) % 1000000007)
from math import sqrt
x = int(input())
cnt = 0
l = []
for i in range(1, x + 1):
    for j in range(1, int(sqrt(i)) +1):
        for k in range(2, i):
            if j ** k == i:
                l.append(i)
print(max(l))

### FIXED CODE ###

from math import sqrt
x = int(input())
cnt = 0
l = []
for i in range(1, x + 1):
    for j in range(1, int(sqrt(i)) +1):
        for k in range(2, 10):
            if j ** k == i:
                l.append(i)
print(max(l))
a,b= map(int,input().split)
if a*b%2==0:
  print("Even")
else:
  print("Odd")

### FIXED CODE ###

a, b = map(int, input().split())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")
print (pow(x,3))



### FIXED CODE ###

x = input('')
x = int(x)
ans = int(pow(x,3))
print(ans)
n,m=map(int,input().split())
a=[0 for i in range(m)]
for i in range(n):
  k=list(map(int,input().split()))
  for j in range(1,k[0]):
    a[k[j]-1]=1
    
print(m.count(0))

### FIXED CODE ###

n,m=map(int,input().split())
a=[0 for i in range(m)]
for i in range(n):
  b=list(map(int,input().split()))
  for i in range(b[0]):
    a[b[i+1]-1]+=1
ans=0
for i in a:
  if i==n:
    ans+=1
print(ans)
import sys
from collections import deque


def solve(n, m, links):
    if m % 2 == 1:
        print(-1)
        return

    going = [set() for _ in range(n)]
    tree = [{} for _ in range(n)]
    parents = [-1] * n
    q = deque([0])
    while q:
        v = q.popleft()
        for u in links[v]:
            if v in going[u]:
                continue
            going[v].add(u)
            if parents[u] == -1:
                tree[v][u] = 0
                parents[u] = v
            q.append(u)

    parities = [len(l) % 2 for l in going]

    # print(going)
    # print(tree)
    # print(parents)
    # print(parities)

    def dfs(v):
        b = parities[v]
        for u in tree[v]:
            c = dfs(u)
            b ^= c
        if b:
            p = parents[v]
            if p != -1:
                going[p].remove(v)
                going[v].add(p)
        return b

    dfs(0)

    ans = ['{} {}'.format(v + 1, u + 1) for v in range(n) for u in going[v]]
    print('\n'.join(ans))


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

links = [set() for _ in range(n)]
for line in sys.stdin:
    a, b = map(int, line.split())
    a -= 1
    b -= 1
    links[a].add(b)
    links[b].add(a)

solve(n, m, links)


### FIXED CODE ###

import sys
from collections import deque

sys.setrecursionlimit(10 ** 5)


def solve(n, m, links):
    if m % 2 == 1:
        print(-1)
        return

    tree = [set() for _ in range(n)]
    parents = [-1] * n
    q = deque([0])
    while q:
        v = q.popleft()
        for u in links[v]:
            if parents[u] == -1:
                tree[v].add(u)
                parents[u] = v
                q.append(u)
            links[u].remove(v)

    parities = [len(l) % 2 for l in links]

    # print(links)
    # print(tree)
    # print(parents)
    # print(parities)

    def dfs(v):
        b = parities[v]
        for u in tree[v]:
            c = dfs(u)
            b ^= c
        if b:
            p = parents[v]
            links[p].remove(v)
            links[v].add(p)
        return b

    dfs(0)

    ans = ['{} {}'.format(v + 1, u + 1) for v in range(n) for u in links[v]]
    print('\n'.join(ans))


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

links = [set() for _ in range(n)]
for line in sys.stdin:
    a, b = map(int, line.split())
    a -= 1
    b -= 1
    links[a].add(b)
    links[b].add(a)

solve(n, m, links)
n,q = map(int,input().split())
ab = [[int(x) for x in input().split()]for _ in range(n-1)]
px = [[int(x) for x in input().split()]for _ in range(q)]

gr = [[]for _ in range(n+1)]
for a,b in ab:
    gr[a].append(b)
    gr[b].append(a)

value = [0]*(n+1)
for p,x in px:
    value[p] += x

def dfs(v,parent,add):
    value[v] += add
    for x in gr[v]:
        if x ==parent:
            continue
        dfs(x,v,value[v])
dfs(1,0,0)

ans = ' '.join(map(str,value[v]))
print(ans)

### FIXED CODE ###

n,q=list(map(int,input().split()))
GR=[[] for _ in range(n)]
for i in range(n-1):
  a,b=list(map(int,input().split()))
  GR[a-1].append(b)
  GR[b-1].append(a)
 
ans=[0 for _ in range(n)]
for i in range(q):
  p,x=list(map(int,input().split()))
  ans[p-1] += x
  
gr=[1]
parent=[0 for _ in range(n)]
while gr:
  po=gr.pop()
  for no in GR[po-1]:
    if no == parent[po-1]:
      continue
    gr.append(no)
    parent[no-1]=po
    ans[no-1] += ans[po-1]
      
print(' '.join(map(str,ans)))
s = input()

n = 0
e = 0
w = 0
s = 0

for v in s:
    if v == 'N': n+=1
    if v == 'E': e+=1
    if v == 'W': w+=1
    if v == 'S': s+=1

if n == s and e == w:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

S = input()

n = 0
e = 0
w = 0
s = 0

for v in S:
    if v == 'N': n+=1
    if v == 'E': e+=1
    if v == 'W': w+=1
    if v == 'S': s+=1
if ((0<n and 0<s) or (n==0 and s==0)) and ((0<e and 0<w) or (e==0 and w==0)):
    print('Yes')
else:
    print('No')
days = input()
if days.contains("RRR"):
    print("3")
elif days.contains("RR"):
    print("2")
elif days.contains("R"):
    print("1")
else:
    print("0")

### FIXED CODE ###

s = input().upper()
if s.count('RRR') == 1:
  print(3)
elif s.count('RR') == 1:
  print(2)
elif s.count('R') > 0:
  print(1)
else:
  print(0)
n= int(input())
p =[int(x) for x in range(int(input()))]
dp = [[0 for i in range(n+1)]for j in range(n+1)]

dp[0][0]=1
for i in range(n):
    for j in range(n):
        dp[i+1][j+1]+=dp[i][j]*p[i]
        dp[i+1][j]+=dp[i][j]*(1-p[i])
an=0
for i in range((n+1)//2,n+1):
    an+=dp[n][i]
print(an)

### FIXED CODE ###

INT_MAX= 100000000
n=int(input())
dp  = [INT_MAX]*(100001)
h=[int(X) for X in input().split()]
dp[0]=0
dp[1]=abs(h[1]-h[0])
for i in range(2,n):

    dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i-2]-h[i]))

print(dp[n-1])
'''
ITP-1_10-A
 ?????¢
?????? P1(x1, y1), P2(x2, y2) ????????¢????±???????????????°????????????????????????
???Input
x1, y1, x2, y2 ????????°???????????????????????§?????????????????????
???Output
P1??¨P2????????¢????????°??§?????????????????????????????????0.0001??\????????????????????£????????????????????¨????????????
'''
# # import
# import numpy
# 
# # inputData
# Data = input().split()
# x1 = int(Data[0])
# y1 = int(Data[1])
# x2 = int(Data[2])
# y2 = int(Data[3])
# 
# P1 = numpy.array([x1, y1])
# P2 = numpy.array([x2, y2])
# print(numpy.linalg.norm(P2 - P1))

import math

def get_distance(x1, y1, x2, y2):
    d = math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
    return d

if __name__ == '__main__':
    # inputData
    Data = input().split()
    x1 = int(Data[0])
    y1 = int(Data[1])
    x2 = int(Data[2])
    y2 = int(Data[3])

    d = get_distance(x1, y1, x2, y2)
    print(d)

### FIXED CODE ###

'''
ITP-1_10-A
 ?????¢
?????? P1(x1, y1), P2(x2, y2) ????????¢????±???????????????°????????????????????????
???Input
x1, y1, x2, y2 ????????°???????????????????????§?????????????????????
???Output
P1??¨P2????????¢????????°??§?????????????????????????????????0.0001??\????????????????????£????????????????????¨????????????
'''
# # import
# import numpy
# 
# # inputData
# Data = input().split()
# x1 = int(Data[0])
# y1 = int(Data[1])
# x2 = int(Data[2])
# y2 = int(Data[3])
# 
# P1 = numpy.array([x1, y1])
# P2 = numpy.array([x2, y2])
# print(numpy.linalg.norm(P2 - P1))

import math

def get_distance(x1, y1, x2, y2):
    d = math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
    return d

if __name__ == '__main__':
    # inputData
    Data = input().split()
    x1 = float(Data[0])
    y1 = float(Data[1])
    x2 = float(Data[2])
    y2 = float(Data[3])

    d = get_distance(x1, y1, x2, y2)
    print(d)
N = int(input())
xlist = []
ylist = []
pqlist = []
pqcount = {}
for i in range(N):
  x, y = map(int, input().split(" "))
  xlist.append(x)
  ylist.append(y)

for i in range(N):
  for j in range(i+1, N):
    p = xlist[i] - xlist[j]
    q = ylist[i] - ylist[j]
    tuple_pq = (p, q,)
    if not (tuple_pq in pqlist):
      pqlist.append(tuple_pq)
      pqcount[tuple_pq] = 1
    else:
      pqcount[tuple_pq] += 1

print(N - max(pqcount.values()))

### FIXED CODE ###

N = int(input())
xlist = []
ylist = []
pqlist = []
pqcount = {}
for i in range(N):
  x, y = map(int, input().split(" "))
  xlist.append(x)
  ylist.append(y)

for i in range(N):
  for j in range(i+1, N):
    p = xlist[i] - xlist[j]
    q = ylist[i] - ylist[j]
    tuple_pq = (p, q,)
    if (-p, -q,) in pqlist:
      tuple_pq = (-p, -q)
    if not (tuple_pq in pqlist):
      pqlist.append(tuple_pq)
      pqcount[tuple_pq] = 1
    else:
      pqcount[tuple_pq] += 1

if N == 1:
  print(1)
else:
  print(N - max(pqcount.values()))
import itertools

n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))

list_range = list(range(1,n+1))
pattern_list = list(itertools.permutations(list_range, n))
pattern_list.sort()
ans = [0] * 2
for i in range(len(pattern_list)):
  if p == list(pattern_list[i]):
    ans[0] = i + 1
  elif q == list(pattern_list[i]):
    ans[1] = i + 1
print(abs(ans[0] - ans[1]))

### FIXED CODE ###

k, x = map(int,input().split())
if k * 500 >= x:
  print("Yes")
else:
  print("No")
S = input()
T = input()
if T[0:len(T)-1] = S:
    print("Yes")

else:
    print("No")


### FIXED CODE ###

S = input()
T = input()
if T[0:len(T)-1] == S:
    print("Yes")

else:
    print("No")
import heapq
[N,L] = [int(x) for x in input().split()]
A = [[int(x),int(i)] for i,x in enumerate(input().split())]
heapq.heapify(A)
ANS = [10**9+1]*N
count = 0
for j in range(N):
    a = heapq.heappop(A)
    for i in range(L):
        try :
            if ANS[a[1]+i] == 10**9+1 :
                ANS[a[1]+i] = a[0]
                count += 1
        except IndexError : continue
    if count + 1000 == N : break

for i in range(L):
    if ANS[i] == 10**9+1 : ANS[i] = min(B[:i+1])
for i in range(L,N):
    if ANS[i] == 10**9+1 : ANS[i] = min(B[i+1-L:i+1])

for i in ANS[L-1:-1]:
    print(i, end=" ")
print(ANS[-1])

### FIXED CODE ###

def ascend(a,b):
    mini = min(A[a:a+L])
    ans[a] = mini
    for i in range(a+1,b):
        if A[i+L-1] <= mini : mini = A[i+L-1]
        elif A[i-1] == mini : mini = min(A[i:i+L])
        ans[i] = mini

def descend(a,b):
    mini = min(A[b-1:b+L-1])
    ans[b-1] = mini
    for i in range(b-2,a-1,-1):
        if A[i] <= mini : mini = A[i]
        elif A[i+L] == mini: mini = min(A[i:i+L])
        ans[i] = mini
    
[N,L] = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
ans = [None]*(N-L+1)
count = 0;
if N > 10 ** 4:
    for i in range(100):
        if A[i+1] > A[i] : count += 1
    if count > 80 : descend(0, N-L+1)
    else : ascend(0,N-L+1)
else :
    ascend(0, N-L+1)
for i in ans[:-1] : print(i, end=" ")
print(ans[-1])
import numpy as np
n,k = input().split()
n = int(n)
k = int(k)
l = list()
for i in range(n):
    a, b = input().split()
    l.append([int(a),int(b)])

ar = np.array(l)
ar_s = ar.sort(0)
count = np.cumsum(ar_s[:,1])

print(ar_s)
print(count)
print(int(ar_s[np.where(count >=k)[0][0]][0]))

### FIXED CODE ###

N, K = map(int,input().split())
# a_list = []
b_dict = {}

for i in range(N):
    a, b = map(int,input().split())
    if a in b_dict:
        b_dict[a] += b
    else:
        b_dict[a] = b
        
a_list = list(b_dict.keys())
a_list.sort()


for a in a_list:
    K -= b_dict[a]
    if K <= 0:
        break

print(a)
n = int(input())
v = list(map(int, input().split()))
o = []
e = []
for i, va in enumerate(v):
    if i % 2 == 0:
        o.append(va)
    else:
        e.append(va)
import collections
o = collections.Counter(o).most_common()
e = collections.Counter(e).most_common()
if o[0][0] == e[0][0]:
    if len(o) == 1 and len(e) == 1:
        print(min(o[0][1], e[0][1]))
    elif len(o) == 1:
        print(n - o[0][1] - e[1][1])
    elif len(e) == 1:
        print(n - o[1][1] - e[0][1])
    else:
        print(n - o[0][1] - max(n[1][1], e[1][1]))
else:
    print(n - o[0][1] - e[0][1])


### FIXED CODE ###

n = int(input())
v = list(map(int, input().split()))
o = []
e = []
for i, va in enumerate(v):
    if i % 2 == 0:
        o.append(va)
    else:
        e.append(va)
import collections
o = collections.Counter(o).most_common()
e = collections.Counter(e).most_common()
if o[0][0] == e[0][0]:
    if len(o) == 1 and len(e) == 1:
        print(min(o[0][1], e[0][1]))
    elif len(o) == 1:
        print(n - o[0][1] - e[1][1])
    elif len(e) == 1:
        print(n - o[1][1] - e[0][1])
    else:
        print(n - o[0][1] - max(o[1][1], e[1][1]))
else:
    print(n - o[0][1] - e[0][1])
strs = input()
 
for i in range(len(strs)):
  if !(i % 2 == 0):
    if (strs[i] == "L") or (strs[i] == "U") or (strs[i] == "D"):
      continue
    else:
      print("No")
      break
  else:
    if (strs[i] == "R") or (strs[i] == "U") or (strs[i] == "D"):
      continue
    else:
      print("No")
      break
else:
  print("Yes")

### FIXED CODE ###

strs = input()
 
for i in range(len(strs)):
  if i % 2 != 0:
    if (strs[i] == "L") or (strs[i] == "U") or (strs[i] == "D"):
      continue
    else:
      print("No")
      break
  else:
    if (strs[i] == "R") or (strs[i] == "U") or (strs[i] == "D"):
      continue
    else:
      print("No")
      break
else:
  print("Yes")
n = int(input())
s = input()

ans = ""
for i in range(n):
  ascii = ord(s[i]) + n
  if ascii > ord('Z'):
    ascii -= ord('A')
  ans += char(ascii)

print(ans)

### FIXED CODE ###

n = int(input())
s = input()

ans = ""
for c in s:
  ascii = ord(c) + n
  if ascii > ord('Z'):
    ascii -= 26
  ans += chr(ascii)

print(ans)
n,m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
bc = sorted([list(map(int, input().split())) for i in range(m)], key =lambda x:x[1])

t = True
cnt = 0

while t == True and cnt < len(bc):
  cnt += 1
  num = bc[cnt-1][0]
  large = bc[cnt-1][1]
  if large > min(a):
    for i in a:
      if i < large and a.index(i)+1 <= num:
        a[a.index(i)] = large
        print(a)
      else:
        break
    a.sort()
  else:
     t = False

print(sum(a))

### FIXED CODE ###

n,m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
bc = sorted([list(map(int, input().split())) for i in range(m)], key =lambda x:x[1])
bc.reverse()

flg = 0
cnt = 0

for i in range(n):
  if bc[flg][1] >a[i] and flg < m:
    a[i] = bc[flg][1]
    cnt +=1
    if cnt == bc[flg][0]:
      flg += 1
      cnt = 0
      if flg == m:
        break
  else:
      break

print(sum(a))
i = 0
def printcase():
    n = input()
    if n == 0:
        break
    print("Case",i ,":" ,n)

if __name__ == "__main__":
    ret = printcase()


### FIXED CODE ###

def printcase():
    i = 1
    n = int(input())
    while n != 0:
        print("Case %d: %d" %(i ,n))
        n = int(input())
        i = i + 1
    return 0

if __name__ == "__main__":
    ret = printcase()
n=int(input())
s=len(n)
ans=0
for i in range(1,s+1):
  ans=(ans+a[-i])%9
if ans==0:
  print('Yes')
else:
  print('No')
  

### FIXED CODE ###

n=int(input())
k=str(n)
s=len(k)
ans=0
for i in range(1,s+1):
  ans=(ans+int(k[-i]))%9
if ans==0:
  print('Yes')
else:
  print('No')
n,x =map(int,input().split())
L=list(map(int,input().split()))
tmp = 0
cnt = 0
for i in range(n+1):
    if tmp > x:
        break
    tmp += L[i]
    cnt += 1
print(cnt)

### FIXED CODE ###

n,x =map(int,input().split())
L=list(map(int,input().split()))
A = [0] * (n+1)
for i in range(1,n+1):
    A[i] = A[i-1] + L[i-1]
cnt=0
for i in range(n+1):
    if A[i] <= x:
        cnt+= 1
print(cnt)
n,k = map(int,input().split())

def make_barger(str):
    return "0" + str + "1" + str + "0"
str = "1"
for i in range(n):
    str = make_barger(str)
cnt = 0
for s in str[-k:]:
    cnt += int(s)
print(cnt)


### FIXED CODE ###

n,k = map(int,input().split())

cnt = [0,1]
tmp = [[0,1]]

for i in range(n):

    tmp.append([cnt[0] * 2 + 2,cnt[1] * 2 + 1])
    cnt[0] = cnt[0] * 2 + 2
    cnt[1] = cnt[1] * 2 + 1

"""
半分に区切ってジャスト半分なら前の分+1を出力
大きければ前の分+1を足して次
小さければ数える数を1小さくしてレベルを下げる
"""
num = 0
for i in range(n,0,-1):
    if (sum(tmp[i])+1)/2 == k:
        num += tmp[i-1][1]+1
        break
    elif (sum(tmp[i])-1)/2 == k:
        num += tmp[i-1][1]
        break
    elif sum(tmp[i]) == k or sum(tmp[i])-1 == k:
        num += tmp[i][1]
        break
    elif (sum(tmp[i])-1)/2 < k:
        num += tmp[i-1][1]+1
        k = k - sum(tmp[i-1]) - 2
    elif (sum(tmp[i])-1)/2 > k:
        k = k - 1
print(num)
n=int(input())

print((1+N)*N//2)

### FIXED CODE ###

N=int(input())

print((1+N)*N//2)
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    S=list(map(int,list(input())))
    if len(S)%2==0:
        left=len(S)//2-1
        right=len(S)//2
        ans=len(S)//2
        if S[left]==S[right]:
            x=S[left]
            while left>=0 and right<len(S) and S[left]==S[right]==x:
                left-=1
                right+=1
                ans+=1
            if left>=0 and right<len(S) and S[left]!=x or S[right]!=x:
                ans-=1
    else:
        left=len(S)//2-1
        right=len(S)//2+1
        ans=len(S)//2+1
        x=S[len(S)//2]
        if left>=0 and right<len(S) and S[left]==S[right]==x:
            ans+=1
            while left>=0 and right<len(S) and S[left]==S[right]==x:
                left-=1
                right+=1
                ans+=1
            if left>=0 and right<len(S) and S[left]!=x or S[right]!=x:
                ans-=1
        elif left>=0 and right<len(S) and S[left]==x or S[right]==x:
            ans+=1
    print(ans)

if __name__ == '__main__':
    main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    S=list(map(int,list(input())))
    N=len(S)
    if N%2==0:
        left=N//2-1
        right=N//2
        ans=N//2
        if S[left]==S[right]:
            x=S[left]
            while left-1>=0 and S[left-1]==x:
                left-=1
            while right+1<N and S[right+1]==x:
                right+=1
            ans+=min(N//2-left,right-N//2+1)
    else:
        left=N//2
        right=N//2
        x=S[N//2]
        ans=N//2+1
        if left-1>=0 and S[left-1]==x:
            while left-1>=0 and S[left-1]==x:
                left-=1
        if right+1<N and S[right+1]==x:
            while right+1<N and S[right+1]==x:
                right+=1
        ans+=min(N//2-left,right-N//2)
    print(ans)

if __name__ == '__main__':
    main()
a = {}
for s in ["S", "H", "C", "D"]:
    a.update({f'{s} {i}': 0 for i in range(1, 14)})
n = int(input())
for _ in range(n):
    s = input()
    print(s)
    del a[s]
        
a = list(a)
for i in len(a):
    print(a[i])
    

    
    


### FIXED CODE ###

a = {}
for s in ["S", "H", "C", "D"]:
    a.update({f'{s} {i}': 0 for i in range(1, 14)})
n = int(input())
for _ in range(n):
    s = input()
    del a[s]
        
a = list(a)
for i in range(len(a)):
    print(a[i])