Problem:


Score : 100 points

Problem Statement

We have A balls with the string S written on each of them and B balls with the string T written on each of them.

From these balls, Takahashi chooses one with the string U written on it and throws it away.

Find the number of balls with the string S and balls with the string T that we have now.

Constraints

S, T, and U are strings consisting of lowercase English letters.

The lengths of S and T are each between 1 and 10 (inclusive).

S \not= T

S=U or T=U.

1 \leq A,B \leq 10

A and B are integers.

Input

Input is given from Standard Input in the following format:

S T
A B
U

Output

Print the answer, with space in between.

Sample Input 1

red blue
3 4
red

Sample Output 1

2 4

Takahashi chose a ball with red written on it and threw it away.
Now we have two balls with the string S and four balls with the string T.

Sample Input 2

red blue
5 5
blue

Sample Output 2

5 4

Takahashi chose a ball with blue written on it and threw it away.
Now we have five balls with the string S and four balls with the string T.



Sample input:
red blue
3 4
red


Sample output:
2 4

Submission status: Accepted

Solution code:
s,t = map(str,input().split())
a,b = map(int,input().split())
u = str(input())
if s == u:
    a -= 1
elif t == u:
    b -= 1
print("{0} {1}".format(a,b))

Submission status: Accepted

Solution code:
S,T = input().split()
A,B = map(int,input().split())
U = input()

if S == U:
  print(A-1,B)

else:
  print(A,B-1)

Submission status: Accepted

Solution code:
S, T = input().split()

A, B = input().split()
A = int(A)
B = int(B)

U = input()

if S == U:
  print (A-1, B)
else:
  print (A, B-1)

Submission status: Accepted

Solution code:
a, b = input().split()
an, bn = map(int, input().split())
s = input()

d = {a: an, b:bn}
d[s] -= 1

print("{} {}".format(d[a], d[b]))

Submission status: Accepted

Solution code:
S, T = input().split(" ")
A, B = tuple(map(int, input().split(" ")))
U = input()
if U == S:
    A -= 1
else:
    B -= 1
print(A, B, sep=" ")

Submission status: Accepted

Solution code:
S, T = map(str, input().split())
A, B = map(int, input().split())
U = input()
if S == U:
    print(A - 1, B)
else:
    print(A, B - 1)

Submission status: Accepted

Solution code:
import sys

INF = 1001001001

def resolve():
  s, t = input().split()
  a , b = map(int, input().split())
  u = input()
  if (s == u):
    print(a - 1, b)
  else:
    print(a, b - 1)
  return

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
s, t = input().split()
a, b = map(int, input().split())
u = input()
if u == s:
  print(a-1, b)
elif u == t:
  print(a, b-1)

Submission status: Accepted

Solution code:
s, t = input().split()
a, b = map(int, input().split())
u = input()
if u == s:
  print(a-1, b)
elif u == t:
  print(a, b-1)
else:
  print(a, b)

Submission status: Accepted

Solution code:
S,T = map(str,input().split())
A,B = map(int,input().split())
s = input()

if s == S:
    A -=1
elif s == T:
    B -=1
print(A,B)

Submission status: Accepted

Solution code:
s,t=input().split()
a,b=map(int,input().split())
u=input()

if u==s:
  a=a-1

if u==t:
  b=b-1

print(*[str(a)+" "+str(b)])

Submission status: Accepted

Solution code:
s,t = input().split()
a,b = map(int,input().split())
u = input()

if s == u:
    a -= 1
elif t  == u:
    b -= 1
print(str(a) + " " + str(b))

Submission status: Accepted

Solution code:
S,T=input().split()
A,B=map(int,input().split())
U=input()
if(U==S):
    print(A-1, B)
else:
    print(A, B-1)

Submission status: Accepted

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


def main():
    s, t = input().split()
    a, b = map(int, input().split())
    u = input()

    if s == u:
        print(a - 1, b)
    else:
        print(a, b - 1)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s, t = map(str, input().split())
a, b = map(int, input().split())
u = str(input())

if s == u:
    print(a-1, b)
else:
    print(a, b-1)

Submission status: Accepted

Solution code:
S, T = input().split()
A, B = map(int, input().split())
U = input()
dct = {}
dct[S] = A
dct[T] = B
dct[U] -= 1
print(dct[S], dct[T])

Submission status: Accepted

Solution code:
s, t = input().split()
a, b = map(int, input().split())
u = input()

if u == s:
    a -=1
else:
    b -=1
print(a,b)

Submission status: Accepted

Solution code:
s, t = map(str, input().split())
a, b = map(int, input().split())
u = str(input())

if (u == s):
    print((a - 1), b)
else:
    print(a, (b - 1))

Submission status: Accepted

Solution code:
s, t = input().split()
a, b = map(int, input().split())
u = input()

if s == u :
  a -= 1
else:
  b -= 1
print(a, b)

Submission status: Accepted

Solution code:
s,t = input().split()
a,b = map(int,input().split())
if input() == s:
  print(a-1,b)
else:
  print(a,b-1)

Submission status: Accepted

Solution code:
S,T = input().split()
A,B = map(int,input().split())
U = input()
if U == S:
    print(A-1,B)
else:
    print(A,B-1)

Submission status: Accepted

Solution code:
S,T = map(str,input().split())
A,B = map(int,input().split())
U = input()

if S==U: A -= 1
if T==U: B -= 1
  
print(str(A) + " " + str(B))

Submission status: Accepted

Solution code:
def main():
    S,T = map(str, input().split())
    a,b = map(int, input().split())
    U = input()

    if U == S:
        a -= 1
    else:
        b -= 1
    print(a,b)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S,T = input().split()
A,B = map(int, input().split())
U = input()


if S==U:
    print(A-1, B)
else:
    print(A, B-1)

Submission status: Accepted

Solution code:
s, t = input().split()
a, b = map(int, input().split())
u = input()
if u==s:
    print(a-1, b)
else:
    print(a, b-1)

Submission status: Accepted

Solution code:
S,T=map(str,input().split())
A,B=map(int,input().split())
U=input()
if U==S:
  A-=1
else:
  B-=1
AN=[A,B]
print(*AN)

Submission status: Accepted

Solution code:
s, t = input().split()
a, b = map(int, input().split())
u = input()
if u == s:
  print(a-1,b)
if u == t:
  print(a,b-1)

Submission status: Accepted

Solution code:
s, t = input().split()
a, b = map(int,input().split())
u = input()

ans = a + b
if s == u:
    a -= 1
if t == u:
    b -= 1
print(str(a) + ' ' + str(b))

Submission status: Accepted

Solution code:

import numpy as np

S, T = input().split()
A, B = (int(x) for x in input().split())
U = input()

if U == S : A -= 1
else : B -= 1

print("{} {}".format(A, B))

Submission status: Accepted

Solution code:
s = list(input().split())
num = list(map(int,input().split()))
target = input()

a = num[0]
b = num[1]

if s[0] == target:
  a = a-1
elif s[1] == target:
  b = b-1

print(a,b)

Submission status: Accepted

Solution code:
s, t = map(str, input().split())
a, b = map(int, input().split())
u = input()

if u == s:
    print(str(a - 1) + ' ' + str(b))
else:
    print(str(a) + ' ' + str(b-1))

Submission status: Accepted

Solution code:
S,T=input().split()
A,B=map(int,input().split())
U=input()
if U==S:
  print(A-1,B)
else:
  print(A,B-1)

Submission status: Accepted

Solution code:
s,t = map(str,input().split())
a,b = map(int,input().split())
u = str(input())

if u == s:
    a -= 1
else:
    b -= 1

print(a,b)

Submission status: Accepted

Solution code:
s, t = input().split()
a, b = [int(x) for x in input().split()]
u = input()

if u == s:
    a -= 1
else:
    b -= 1
print(a, b)

Submission status: Accepted

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

s, t = input().split()
a, b = map(int, input().split())
u = input()

if s == u:
    print(str(a-1) + ' ' + str(b))
else:
    print(str(a) + ' ' + str(b-1))

Submission status: Accepted

Solution code:
from decimal import*
from fractions import*
import math
import functools


import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read 
inputt = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines 

s,t=input().split()
a,b=input().split()
u=input()
if(u==s):
    a=int(a)-1
else:
    b=int(b)-1
print(a,end=" ")
print(b)

Submission status: Accepted

Solution code:
def main():
  S,T=input().split()
  A,B=input().split()
  U=input()
  if S == U:
    A=int(A)-1
  elif T == U:
    B=int(B)-1
  print(str(A) +" " +str(B))

main()

Submission status: Accepted

Solution code:
S,T = map(str, input().split())
A,B = map(int, input().split())
U = input()

if U==S:
  A-=1
else:
  B-=1

print(A, B)

Submission status: Accepted

Solution code:
s,t=input().split()
a,b=map(int,input().split())
u=input()
if u==s:
    a=a-1
if u==t:
    b=b-1
print(a,b)

Submission status: Accepted

Solution code:
from sys import stdin
S,T = [(x) for x in stdin.readline().rstrip().split()]
A,B = [int(x) for x in stdin.readline().rstrip().split()]
U = (stdin.readline().rstrip())
if U == S:
    A -= 1
else:
    B -= 1
print(A,B)

Submission status: Accepted

Solution code:
a,b = input().split()
ai,bi = map(int,input().split())
s = input()
if a == s: ai-=1
if b == s: bi-=1
print(ai,bi)

Submission status: Accepted

Solution code:
s,t = input().split()
a,b = map(int,input().split())
u = input()
if u==s:
    print(a-1,b)
else:
    print(a,b-1)

Submission status: Accepted

Solution code:
S, T=map(str, input().split())
A, B=map(int, input().split())
U=input()
if S==U:
  print(str(A-1)+' '+str(B))
elif T==U:
  print(str(A)+' '+str(B-1))

Submission status: Accepted

Solution code:
S,T = map(str,input().split())
A,B = map(int,input().split())
U = input()

if U == T:
    print(A,B-1)
else:
    print(A-1,B)

Submission status: Accepted

Solution code:
def main():
    s, t = map(str, input().split())
    a, b = map(int, input().split())
    u = input()
    if (u == s):
        print("{} {}".format(a-1, b))
    else:
        print("{} {}".format(a, b-1))

if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
S, T = map(str, input().split())
A, B = map(int, input().split())
U = input()

if U == S:
  A -= 1
else:
  B -= 1
  
print (str(A) + " " + str(B))

Submission status: Accepted

Solution code:
S,T=map(str,input().split())
A,B=map(int,input().split())
U=input()
if U == S:
  A-=1
elif U == T:
  B-=1
print(A,B)

Submission status: Accepted

Solution code:
input_texts = input()
text_list = input_texts.split(" ")
text_s = text_list[0]
text_t = text_list[1]

input_counts = input()
count_list = input_counts.split(" ")
count_s = int(count_list[0])
count_t = int(count_list[1])

pull_text = input()

if pull_text == text_s:
    count_s -= 1
else:
    count_t -= 1
output = str(count_s) + " " + str(count_t)
print(output)

Submission status: Accepted

Solution code:
s, t = input().split()
a, b = list(map(int, input().split()))
u = input()
if u == s:
    print("{} {}".format(a-1, b))
else:
    print("{} {}".format(a, b-1))

Submission status: Accepted

Solution code:
import math

import numpy as np
import scipy as scp

# 入力の受け取り
s,t = input().split()
a,b = map(int,input().split())
u = input()

dic = {s:a,t:b}

if u == s:
    dic[s] -= 1
else:
    dic[t] -= 1

print(dic[s],dic[t])

Submission status: Accepted

Solution code:
s, t = input().split()
u, v = map(int, input().split())
a = input()
d = {}
d[s] = u
d[t] = v
d[a] -= 1
print(d[s], d[t])

Submission status: Accepted

Solution code:
S, T = map(str, input().split(' '))
A, B = map(int, input().split(' '))
U = str(input())

if S == U:
    print(str(A - 1) + ' ' + str(B))
if T == U:
    print(str(A) + ' ' + str(B - 1))

Submission status: Accepted

Solution code:
S,T=input().split()
A,B=map(int,input().split())
U=input()
if (S==U):
  print (A-1,B)
else:
  print (A,B-1)

Submission status: Accepted

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


def main():
    S, T = input().split()
    A, B = map(int, input().split())
    U = input()
    if S == U:
        print(A - 1, B)
    else:
        print(A, B - 1)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
s, t = input().split()
a, b = map(int, input().split())
u = input()

if u == s:
  a -= 1
else:
  b -= 1
  
print(a, b)

Submission status: Accepted

Solution code:
s, t = input().split()
a, b = map(int,input().split())
u = input()
if u == s:
  print(a-1,b)
else:
  print(a,b-1)

Submission status: Accepted

Solution code:
s,t=input().split()
a,b=map(int,input().split())
if s==input():
  a-=1
else:
  b-=1
print(a,b)

Submission status: Accepted

Solution code:
s, t = map(str, input().split())
a, b = map(int, input().split())
u = input()

if s == u:
  a -= 1
else:
  b -= 1

print(a, b)

Submission status: Accepted

Solution code:
s, t = input().split()
a, b = map(int, input().split())
u = input()

if u == s:
	a -= 1
elif u == t:
	b -= 1
print(a, b)

Submission status: Accepted

Solution code:
s,t=input().split()
a,b=map(int,input().split())
if s==input(): a-=1
else: b-=1
print(a,b)

Submission status: Accepted

Solution code:
S, T = input().split()
A, B = map(int, input().split())
U = input()

if S == U:
  print(str(A-1) + ' ' + str(B))

else:
  print(str(A) + ' ' + str(B-1))

Submission status: Accepted

Solution code:
s,t=input().split()
a,b=map(int,input().split())
u=input()
if s==u:
    print("{0} {1}".format(a-1,b))
else:
    print("{0} {1}".format(a,b-1))

Submission status: Accepted

Solution code:
input_str = list(map(str, input().split()))
input_num = list(map(int, input().split()))
input_out = str(input())

if input_out == input_str[0]:
    input_num[0] -= 1
elif input_out == input_str[1]:
    input_num[1] -= 1

print(input_num[0],input_num[1])

Submission status: Accepted

Solution code:
str = list(map(str, input().split()))
n = list(map(int, input().split()))
u = input()

if u == str[0]: n[0] -= 1
else: n[1] -= 1

print("{} {}".format(n[0], n[1]))

Submission status: Accepted

Solution code:
s,t = input().split()
sn,tn = map(int,input().split())
u  = input()

if s == u:
    print(str(sn-1) + ' '+ str(tn))
else:
    print(str(sn) + ' ' + str(tn-1))

Submission status: Accepted

Solution code:
S,T=input().split()
A,B=list(map(int,input().split()))
if S==input():
    A-=1
else:
    B-=1
print(A,B)

Submission status: Accepted

Solution code:
s,t=map(str,input().split())
a,b=map(int,input().split())
u=input()
if u==s:
  print(str(a-1)+' '+str(b))
else:
  print(str(a)+' '+str(b-1))

Submission status: Accepted

Solution code:
s,t=map(str,input().split())
a,b=map(int,input().split())
u=input()
if s==u:
    a-=1
if t==u:
    b-=1
print(a,b)

Submission status: Accepted

Solution code:
s, t = input().split()
a, b = map(int, input().split())
u = input()

if u == s:
    a = a - 1
else:
    b = b - 1
    
print(a, b)

Submission status: Accepted

Solution code:
s, t = input().split()
a ,b = map(int, input().split())
u = input()

if u == s:
    a = a - 1
    print(a, b)
else:
    b = b - 1
    print(a, b)

Submission status: Accepted

Solution code:
S,T = map(str,input().split())
A,B = map(int,input().split())
U = str(input())
if S == U:
    print(A-1,B)
else:
    print(A,B-1)

Submission status: Accepted

Solution code:
s,t,a,b,u=open(0).read().split()
d={s:int(a),t:int(b)}
d[u]-=1
print(d[s],d[t])

Submission status: Accepted

Solution code:
s, t = input().split()
a, b = list(map(int,input().split()))
u = input()

if s == u:
    a -= 1
else:
    b -= 1

print(a,b)

Submission status: Accepted

Solution code:
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    s, t = list(map(str, readline().rstrip().decode('utf-8').split()))
    a, b = list(map(int, readline().split()))
    u = str(readline().rstrip().decode('utf-8'))
    if s == u:
        print(a - 1, b)
    else:
        print(a, b - 1)


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    s,t=STRM()
    a,b=INTM()
    u=STR()
    if s==u:
        print(a-1,b)
    else:
        print(a,b-1)
if __name__ == '__main__':
    do()

Submission status: Accepted

Solution code:
a,b=input().split()
x,y=map(int,input().split())
c=input()
if c==a:
  print(x-1,y)
else:
  print(x,y-1)

Submission status: Accepted

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

# RemainingBalls
s, t = input().split()
a, b = map(int, input().split())
u = input()

if s == u:
    print(a-1, b)
elif t == u:
    print(a, b-1)

Submission status: Accepted

Solution code:
s,t = input().split()
a,b = map(int, input().split())
u = input()

print(str(a-1)+" "+str(b) if s==u else str(a)+" "+str(b-1))

Submission status: Accepted

Solution code:
s,t=input().split()
ac,bc=input().split()
a,b=int(ac),int(bc)
u=input()
if s==u:
  print(a-1,b)
else:
  print(a,b-1)

Submission status: Accepted

Solution code:
def resolve():
    S, T = input().split()
    A, B = map(int, input().split())
    U = input()

    if S == U:
        A -= 1
    else:
        B -= 1
 
    print(str(A) + " " + str(B))
 
if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
S, T = input().split()
A, B= map(int, input().split())
U = input()
if S == U:
    A-=1
else:
    B-=1
print(A,B)

Submission status: Accepted

Solution code:
S, T = input().split()
A, B= map(int, input().split())
U = input()
if S == U:
    print(A - 1, B)
else:
    print(A, B - 1)

Submission status: Accepted

Solution code:
ball_list = input().split()
ball_num = list(map(int, input().split()))
text = input()

if text == ball_list[0]:
    ball_num[0] -= 1
else:
    ball_num[1] -= 1

print(str(ball_num[0]) + " " + str(ball_num[1]))

Submission status: Accepted

Solution code:
s,t=map(str,input().split())
a,b=map(int,input().split())
u=input()
if s==u:
  a-=1
else:
  b-=1
print(a,b)

Submission status: Accepted

Solution code:
s,t = map(str,input().split())
a,b = map(int,input().split())
u = input()

if u == s:
    a -= 1
else:
    b -= 1
    
print("{} {}".format(a,b))

Submission status: Accepted

Solution code:
s,t=[x for x in input().split()]
a,b=[int(y) for y in input().split()]
u=input()
if s==u:
    print("{} {}".format(a-1,b))
else:
    print("{} {}".format(a,b-1))

Submission status: Accepted

Solution code:
S,T = input().split()
A,B = map(int,input().split())
U = input()
if S==U:
  A -= 1
else:
  B -= 1
print(A, B)

Submission status: Accepted

Solution code:
S,T = input().split()
A,B = map(int,input().split())
U = input()

if U == S:
  A = A - 1
else:
  B = B - 1
print(A,B)

Submission status: Accepted

Solution code:
S, T = input().split()
A, B = map(int, input().split())
U = input()

if U == S:
  A = A - 1
else:
  B = B - 1
print(A, B)

Submission status: Accepted

Solution code:
Moji = input().split()
Ball = input().split()
Takahasi = input()

if Moji[0] == Takahasi:
  print(int(Ball[0])-1,int(Ball[1]))
else:
  print(int(Ball[0]),int(Ball[1])-1)

Submission status: Accepted

Solution code:
[S,T] = list(input().split()) #文字列やからmapいらん
[A,B] = list(map(int,input().split())) #map(関数,list))でlistの要素それぞれに関数適用
N=input()
if S==N:
    print(A-1,B)
else:
    print(A,B-1)

Submission status: Accepted

Solution code:
S, T = input().split()
A, B = map(int, input().split())
if S == input():
    A -= 1
else:
    B -= 1
print("{0} {1}".format(A, B))

Submission status: Accepted

Solution code:
s, t = list(input().split())
a, b = map(int, input().split())
u = input()
dic = {s: a, t: b}
dic[u] = dic[u]-1
print(dic[s], dic[t])

Submission status: Accepted

Solution code:
[s, t] = input().split()
[a, b] = input().split()
u = input()

if (u == s):
    a = int(a) - 1
else:
    b = int(b) - 1

print(a, b)

Submission status: Accepted

Solution code:
a,b = map(str,input().split())
c,d = map(int,input().split())
e = input()
if a == e:
    print(c-1)
    print(d)
else:
    print(c)
    print(d-1)

Submission status: Accepted

Solution code:
s,t = (str(i) for i in input().split())
a, b = (int(i) for i in input().split())
u = input()
if u == s:
    a -= 1
elif u == t:
    b -= 1
print(a, b)

Submission status: Accepted

Solution code:
a,s=input().split()
m,n=map(int,input().split())
x=input()
print(m-(a==x),n-(s==x))

Submission status: Accepted

Solution code:
dic_lst=[]
lst_a=input().split()
lst_b=list(map(int,input().split()))
wd=input()
for i in range(2):
    dic_lst.append([lst_a[i],lst_b[i]])
    if dic_lst[i][0]==wd:
        dic_lst[i][1]-=1
ans=[]
for i in range(2):
    ans.append(str(dic_lst[i][1]))
print(" ".join(ans))

Submission status: Accepted

Solution code:
# Initializing variables
strA, strB = input().split()
Aballs, Bballs = map(int, input().split())
u = input()

# Calculating remaining balls
if u == strA:
    print(str(int(Aballs - 1)) + " " + str(Bballs))
else:
    print(str(Aballs) + " " + str(int(Bballs - 1)))

# Check out my Youtube channel! https://www.youtube.com/channel/UCMOKVyAbTZOpKikTrX5dy_A

Submission status: Accepted

Solution code:
s,t=input().split()
a,b=map(int,input().split())
u=input()
if s==u:
    print(a-1,b)
else:print(a,b-1)

Submission status: Accepted

Solution code:
wrd = input().split()
AB = input().split()
U = input()

num = list(map(int, AB))

if wrd[0]==U:
    num[0] -=1
else:
    num[1] -=1

print(num[0], num[1])

Submission status: Accepted

Solution code:
s,t=input().split(" ")
a,b=map(int,input().split(" "))
u=input()
 
if s==u:
  print(a-1, b)
else:
  print(a, b-1)

Submission status: Accepted

Solution code:
s,t = map(str, input().split())
a,b = map(int, input().split())
u = str(input())
if u == s:
    print('{} {}'.format(a-1, b))
else:
    print('{} {}'.format(a, b-1))

Submission status: Accepted

Solution code:
#A - Remaining Balls
s,t = list(map(str,input().split()))
a,b = list(map(int,input().split()))
u = str(input())
if(s == u):
    print('{} {}'.format(a-1,b))
else:
    print('{} {}'.format(a,b-1))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
s,t = [i for i in input().split(" ")]
a,b = [int(i) for i in input().split(" ")]
u = input()

if s == u:
    print("{} {}".format(a-1,b))
else:
    print("{} {}".format(a,b-1))

Submission status: Accepted

Solution code:
S, T = map(str, input().split())
A, B = map(int, input().split())
U = str(input())
if U == S:
  A -= 1
else:
  B -= 1
print(A,B)

Submission status: Accepted

Solution code:
a, b = input().split()
c = [int(i) for i in input().split()]
g = input()

if a == g:
  c[0] = c[0] - 1
else:
  c[1] = c[1] - 1

h = [str(i) for i in c]
print(' '.join(h))

Submission status: Accepted

Solution code:
S,T = input().split()
cnt = [int(i) for i in input().split()]
U = input()
 
if U == S:
  cnt[0] -= 1
else:
  cnt[1] -= 1

print(" ".join([str(j) for j in cnt]))

Submission status: Accepted

Solution code:
s, t = input().split()
a, b= map(int, input().split())
u = input()

if u==s:
  print(a-1, b)
else:
  print(a, b-1)

Submission status: Accepted

Solution code:
s, t = input().split(" ")
a, b = map(int, input().split(" "))
if input() == s:
    print(a - 1, b)
else:
    print(a, b - 1)

Submission status: Accepted

Solution code:
color = input().split()
a, b = map(int, input().split()) 
target_color = input()

if color[0] == target_color:
  a -= 1
if color[1] == target_color:
  b -= 1

print(a,b)

Submission status: Accepted

Solution code:
s,t=list(map(str,input().split()))
a,b=list(map(int,input().split()))
u=str(input())

if s==u:
  a-=1
elif t==u:
  b-=1
  
print(a,b)

Submission status: Accepted

Solution code:
S,T = input().split()
A,B = map(int,input().split())
U = input()
count_S = U.count(S)
count_T = U.count(T)


S_amount = A - count_S
U_amount = B - count_T

print(S_amount,U_amount)

Submission status: Accepted

Solution code:
s,t=input().split()
a,b=map(int,input().split())
x=input()
if x==s:
    print(a-1, b)
else: print(a, b-1)

Submission status: Accepted

Solution code:
s, t = input().split()
a, b = map(int, input().split())
u = input()
if u == s:
    a-= 1
else: b -= 1
print(a, b)

Submission status: Accepted

Solution code:
s, t = raw_input().split()
a, b = map(int, raw_input().split())
u = raw_input()

d = {s: a, t: b}
d[u] -= 1

print d[s], d[t]

Submission status: Accepted

Solution code:
s, t = map(str, input().split())
a, b = map(int, input().split())
u = input()

if u == s:
    a -= 1

else:
    b -= 1

print('{} {}'.format(a,b))

Submission status: Accepted

Solution code:
st = input().split()
ab = input().split()
U = input()
S, T = st[0], st[1]
A, B = [int(num) for num in ab]
if U == S:
  A -= 1
elif U == T:
  B -= 1
print(str(A)+" "+str(B))

Submission status: Accepted

Solution code:
S,T=input().split()
A,B=map(int,input().split())
U=input()

if S==U:
    A=A-1
elif T==U:
    B=B-1
print(A,B)

Submission status: Accepted

Solution code:
S,T=input().split()
a,b=map(int,input().split())
x=input()
if x==S:
  print(a-1,b)
else:
  print(a,b-1)

Submission status: Accepted

Solution code:
a,b   = input().split()
aa,bb = map(int, input().split())
c     = input()

if (c == a):
  aa = aa - 1
else:
  bb = bb - 1
print(aa,bb)

Submission status: Accepted

Solution code:
# Initializing variables
s, t = input().split()
a, b = input().split()
a = int(a)
b = int(b)
u = input()

# Calculating remaining balls
if u == s:
    print(str(int(a-1)) + " " + str(b))
else:
    print(str(a) + " " + str(int(b-1)))

Submission status: Accepted

Solution code:
s, t = map(str, input().split())
a, b = map(int, input().split())
u = input()
if s == u:
    a -= 1
elif t == u:
    b -= 1
print(str(a) + ' '+  str(b))

Submission status: Accepted

Solution code:
S,T = input().split()
A,B = map(int,input().split())
U = input()

if U == S:
    A -= 1
else:
    B -=1
    
print("{} {}".format(A,B))

Submission status: Accepted

Solution code:
s,t = input().split()
a,b = map(int,input().split())
u = input()

if u == s:
  print(a-1,b)
elif u == t:
  print(a,b-1)
else:
  print(a,b)

Submission status: Accepted

Solution code:
Ball = list(map(str, input().split()))
Num = list(map(int, input().split()))
OutputBall = input()
Output = [Num[i] - 1 if Ball[i] == OutputBall else Num[i] for i in range(2)]
print(Output[0], Output[1])

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
S, T = input().split()
A, B = map(int, input().split())
U = input().rstrip()
if U == S:
    A -= 1
else:
    B -= 1
print(A, B)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
S, T = input().split()
A, B = map(int, input().split())
U = input().split('\n')[0]
if U == S:
    print("{} {}".format(A-1, B))
else:
    print("{} {}".format(A, B-1))

Submission status: Accepted

Solution code:
S,T=map(str,input().split())
A,B=map(int,input().split())
U=input()

if S == U:
  A -= 1
else :
  B -= 1

print(A, B)

Submission status: Accepted

Solution code:
S, T = input().split()
A, B = map(int, input().split())
U = input()
if S == U:
    print(A - 1)
    print(B)
else:
    print(A)
    print(B-1)

Submission status: Accepted

Solution code:
s,t = map(str,input().split())
a,b = map(int,input().split())
u = input()
if u==s:
    print(a-1,b)
else:
    print(a,b-1)

Submission status: Accepted

Solution code:
S,T=map(str,input().split())
A,B=map(int,input().split())
U=input()

print(A-1,B) if(S==U) else print(A,B -1)

Submission status: Accepted

Solution code:
S, T = input().split()
A, B = map(int, input().split())
U = input()

if U == S:
    A -= 1
elif U == T:
    B -= 1

print(A, end=" ")
print(B)

Submission status: Accepted

Solution code:
words = input().split()
cards  = [int(x) for x in input().split()]
drop   = input()

if drop == words[0]:
    cards[0] -= 1
    print(str(cards[0]) + " " + str(cards[1]))
elif drop == words[1]:
    cards[1] -= 1
    print(str(cards[0]) + " " + str(cards[1]))

Submission status: Accepted

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


def solve(S: str, T: str, A: int, B: int, U: str):
    if U==S:
        print(' '.join(map(str, [A-1, B])))
    else:
        print(' '.join(map(str, [A, B-1])))

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    T = next(tokens)  # type: str
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    U = next(tokens)  # type: str
    solve(S, T, A, B, U)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
temp = input().split()
s = temp[0]
t = temp[1]
num = list(map(int, input().split()))
u = input()

if s == u :
    num[0] = num[0] - 1
else :
    num[1] = num[1] - 1

print(num[0], num[1])

Submission status: Accepted

Solution code:
S,T = map(str, input().split())
A,B = map(int, input().split())
U = str(input())

if U == S:
    print(A-1,B)
elif U == T:
    print(A,B-1)
else:
    print(A,B)

Submission status: Accepted

Solution code:
s = input().split()
a = list(map(int,input().split()))
U = input()
if U == s[0]:
  a[0] = a[0] - 1
else:
  a[1] = a[1] - 1
print(str(a[0])+" "+str(a[1]))

Submission status: Accepted

Solution code:
a = list(map(str,input().split()))
b = list(map(int,input().split()))
c = input()

b[a.index(c)] -= 1

for i in range(len(b)):
	print(b[i],end=' ')

Submission status: Accepted

Solution code:
moji = input().split()
ball = list(map(int, input().split()))

ball[moji.index(input())] -= 1

print(*ball)

Submission status: Accepted

Solution code:
s,t = map(str, input().split())
a,b = map(int, input().split())
u = input()

s_dic = {}
t_dic = {}

s_dic[s] = a
t_dic[t] = b

if u in s_dic:
    s_dic[s] -= 1
elif u in t_dic:
    t_dic[t] -= 1

ans = str(s_dic[s]) + ' ' + str(t_dic[t])

print(ans)

Submission status: Accepted

Solution code:
s,t = input().split()
a,b = map(int, input().split())
u = input()

if u == s:
    a-=1
else:
    b-=1

print(a,b)

Submission status: Accepted

Solution code:
s, t = map(str, input().split())
a, b = map(int, input().split())
u = input()
d = {s:a, t:b}
d[u] -= 1
print(d[s], d[t])

Submission status: Accepted

Solution code:
s,t=input().split()
a,b=map(int,input().split())
u=input()

if u==s:
  a-=1
else:
  b-=1
print(a,b)

Submission status: Accepted

Solution code:
s,t = input().split()
sa,tb = map(int,input().split())
u = input()
if u == s:
    sa -= 1
else:
    tb -= 1
print(sa,tb)

Submission status: Accepted

Solution code:
S,T = input().split()
A,B = map(int,input().split())
U = input()

if U == S:
    A -= 1
elif U == T:
    B -= 1


print(A,B)

Submission status: Accepted

Solution code:
S, T = (str(x) for x in input().split(' '))
A, B = (int(x) for x in input().split(' '))
U = input()
#実体処理
if U==S:
  A-=1
else:
  B-=1
print(A,B)

Submission status: Accepted

Solution code:
# ABC154 A

s, t = input().split()
a, b = map(int, input().split())
u = input()

if u == s:
    print(a - 1, b)
else:
    print(a, b - 1)

Submission status: Accepted

Solution code:
S, T = map(str, input().split())
A, B = map(int, input().split())
U = input()

if U == S:
    A = A - 1
elif U == T:
    B -= 1

print(str(A) + " " + str(B))

Submission status: Accepted

Solution code:
s,t = input().split()
a,b = input().split()
u = input()

if u == s:
    print(int(a)-1,b)
else:
    print(a,int(b)-1)

Submission status: Accepted

Solution code:
s,t = map(str,input().split())
a,b = map(int,input().split())
u = input()

if s==u:
    print(a-1, b)
elif u==t:
    print(a, b-1)

Submission status: Accepted

Solution code:
s, t = input().split()
a, b = map(int, input().split())
if s == input():
  print(a-1,b)
else:
  print(a,b-1)

Submission status: Accepted

Solution code:
S,T = input().split()
A,B = input().split()
U = input()

if U == S:
  print(int(A)-1, B)
else:
  print(A, int(B)-1)