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 = 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:
def f(s, t, a, b, u):
    if u == s:
        print(a - 1, b)
    else:
        print(a, b - 1)

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

f(s, t, a, b, u)

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())
u = input()
if s == u:
    print("{} {}".format(a - 1, b))
else:
    print("{} {}".format(a, b - 1))

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S, T = map(str, input().split())
A, B = MAP()
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 = list(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:
a,b=input().split()
c,d=map(int,input().split())
e=input()
if e== a:
    print(c-1,d)
else:
    print(c,d-1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    s, t = input().split()
    a, b = map(int, input().split())
    u = input()
    if u == s:
        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=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()

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

Submission status: Accepted

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

for i in range(0, 2):
    if a[i] == c:
        b[i] -= 1

print(*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)
elif t==u:
    print(a,b-1)

Submission status: Accepted

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

dic = {s: a, t: b}
dic[u] -= 1
print(str(dic[s]) + " " + str(dic[t]))

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 = 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()

dic = {}
dic[S] = A
dic[T] = B

dic[U] -= 1

print(dic[S],dic[T])

Submission status: Accepted

Solution code:
s,t=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 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 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:
    A = A-1
else:
    B = 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:
  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)
elif U==T:
    print(A,'',B-1)

Submission status: Accepted

Solution code:
# ABC154 -virtual
# A
if True:
    S,T=input().split()
    A,B=map(int,input().split())
    U=input()
    if U==S:
        A-=1
    else:
        B-=1
    print(A,B)
# B
if False: print('x'*len(input()))
# C
if False:
    N=int(input())
    A=[int(i) for i in input().split()]
    print('YES' if len(A)==len(set(A)) else 'NO')
# D
# E
# F

Submission status: Accepted

Solution code:
[S,T]=[item for item in input().split()]
[A,B]=[int(item)for item in input().split()]
U=input()

if U == S:
    A -= 1
elif U == T:
    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(A, B)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

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 = input()

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

Submission status: Accepted

Solution code:
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

S, T = sr().split()
A, B = lr()
U = sr()
if S == U:
    A -= 1
else:
    B -= 1

print(A, B)
# 18

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:
astr, bstr = input().split()
a,b = map(int,input().split())
target = input()

if astr == target:
  a = a-1
else:
  b = b-1

print(str(a) + " " + str(b))

Submission status: Accepted

Solution code:
import os

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

if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
written = list(input().split())
balls = list(map(int, input().split()))
U = input()

for word in range(2):
  if U == written[word]:
    balls[word] -= 1
for i in balls:
  print(i, end = " ")

Submission status: Accepted

Solution code:
a,b = input().split()
x,y = map(int,input().split())
k = input()

if a == k:
  print(x-1,y)
else:
  print(x,y-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 -= 1

if u == t:
    b -= 1

print('%d %d' % (a, b))

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

s,t = nn()
a,b = na()
u = ns()

if s == u:
    a -= 1
if t == u:
    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:
    A-=1
else :
    B-=1
print('{} {}'.format(A,B))

Submission status: Accepted

Solution code:
input_line=input().split(" ")
S,T=input_line[0],input_line[1]
input_line=input().split(" ")
A,B=int(input_line[0]),int(input_line[1])
U=input()
if S==U:
    A=A-1
else:
    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
else:
    b-=1
print(a,b)

Submission status: Accepted

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

if ST[0]==U[0]:
  print(A-1,B)
else:
  print(A,B-1)

Submission status: Accepted

Solution code:
x = input()
y = input()
z = input()

x = x.split()
y = y.split()
z = str(z)

num1 = int(y[0])
num2 = int(y[1])

str1 = str(x[0])
str2 = str(x[1])

if z == str1:
    num1 = num1 - 1
    print(str(num1) + ' ' + str(num2))
elif z == str2:
    num2 = num2 - 1
    print(str(num1) + ' ' + str(num2))

Submission status: Accepted

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

if U==S:
    A -= 1

if U==T:
    B -= 1

print(A, B)

Submission status: Accepted

Solution code:
s, t = input().strip().split()
a, b = map(int, input().strip().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 S == U:
    A -= 1
if T == U:
    B -= 1
print(A,B)

Submission status: Accepted

Solution code:
S, T = input().split() #文字列のスペース区切り
A, B = list(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 = map(str,input().split())
a,b = map(int,input().split())
u = input()
if s == u:
    print("{} {}".format(a-1,b))
elif t == u:
    print("{} {}".format(a,b-1))
else:
    print("{} {}".format(a,b))

Submission status: Accepted

Solution code:
S, T = input().split()
A, B = (int(x) for x in 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:
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:
    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)
elif t==u:
    print(a,b-1)

Submission status: Accepted

Solution code:
def main():
    colors = input().split()
    nums = list(map(int, input().split()))
    d = {
        colors[i]: nums[i] for i in range(2)
        }
    colors_rm = input()
    d[colors_rm] -= 1
    print(d[colors[0]], d[colors[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:
        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:
    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:
x, y = [s for s in input().split()]
a, b = [int(s) for s in input().split()]
z = input()

temp_dict = {
    x: a,
    y: b,
}
temp_dict[z] -= 1

print(temp_dict[x], temp_dict[y])

Submission status: Accepted

Solution code:
S, T = input().split()
A, B = map(int, input().split())
U = input()
print(A if U == T else A-1, B if U == S else 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 = 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:
#---Remaining Balls
S, T = map(str, 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()
if(s==u): print(a-1,b)
else: print(a,b-1)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
import math
def print_ans(S, T, A, B, U):
    """Test Case
    >>> print_ans("red", "blue", 3, 4, "red")
    2 4
    >>> print_ans("red", "blue", 5, 5, "blue")
    5 4
    """
    if S == U:
        A = A -1
    else:
        B = B -1
    print('{} {}'.format(A, B))


if __name__ == '__main__':
    S, T = input().rstrip().split()
    A, B = map(int, input().rstrip().split())
    U = input().rstrip()
    print_ans(S, T, A, B, U)

Submission status: Accepted

Solution code:
s1, s2 = input().split()
a, b = map(int, input().split())
s3 = input()

if s1==s3:
  print(a-1, ' ', b)
elif s2==s3:
  print(a, ' ', b-1)

Submission status: Accepted

Solution code:
a, b = input().split()
n, m = map(int, input().split())
throw = input()

if throw == a:
    print((n-1), m)
else:
    print(n, m-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
print(a,b)

Submission status: Accepted

Solution code:
s1 = input().split()
s2= s1[1]
s1=s1[0]

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

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

Submission status: Accepted

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

if A[0] == 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 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 S==U:
    print(A-1,B)
if T==U:
    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 s==u:
	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 S == U:
    A -= 1
elif T == U:
    B -= 1

print(A,B)

Submission status: Accepted

Solution code:
S, T = input().split()
lis = list(input().split())
N1 = int(lis[0])
N2 = int(lis[1])
Z = input()
#print(S,T,lis,Z,N1,N2)

if Z == S:
    print(N1-1,N2)
elif Z == T:
    print(N1,N2-1)
else:
    print(N1,N2)

Submission status: Accepted

Solution code:
vars = [exec("global {0}; {0}={1}".format(var, val)) or var for var, val in zip(input().split(), input().split())]

exec("{}-=1".format(input()))

print(*(eval(var) for var in vars))

Submission status: Accepted

Solution code:
s,t=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()

Balls = {}
Balls[S] = A
Balls[T] = B
Balls[U] -= 1

print(Balls[S], Balls[T])

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    s,t = input().rstrip().split()
    a,b = map(int, input().split())
    u = input().rstrip()
    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()
n, m = map(int, input().split())
u = input()
if u == s:
    print(n-1, m)
else:
    print(n, m-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 = input().split()
a, b = map(int, input().split())
u = input()

ball_dict = {}
ball_dict[s] = a
ball_dict[t] = b
ball_dict[u] = ball_dict[u] - 1
print(ball_dict[s], ball_dict[t])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S, T, A, B ,U = open(0).read().strip('\n').split()
A = int(A)
B = int(B)
print(int(A) - (1 if U == S else 0))
print(int(B) - (1 if U == T else 0))

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=[int(s) for s in input().split(" ")]
U=input()

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

print(A,B)

Submission status: Accepted

Solution code:
def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

s,t=s1()
a,b=n1()
u=s0()
if s==u:
    a=a-1
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 = input()
if U == S :
    A = A - 1
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 u == s:
    print('%d %d\n' % (a - 1, b))
else:
    print('%d %d\n' % (a, b-1))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s,t = list(input().split())
a,b = list(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 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()

dict = dict()

dict[S] = A
dict[T] = B

dict[U] -= 1

print(dict[S],dict[T])

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 = 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 = 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())
U = input()
print(A - (S == U), B - (T == U))

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())
u = input()

sa = a
tb = b

if s == u:
    sa -= 1
if t == u:
    tb -= 1
print(sa, tb)

Submission status: Accepted

Solution code:
inputted = input().split()
S = inputted[0]
T = inputted[1]
inputted = list(map(int, input().split()))
A = inputted[0]
B = inputted[1]
U = input()

A2 = A - 1 if U == S else A
B2 = B - 1 if U == T else B

output = "{} {}".format(A2, B2)

print(output)

Submission status: Accepted

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

if U == S:
    print(" ".join(map(str,[A-1,B])))
else:
    print(" ".join(map(str,[A,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:
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 = input().split()
num = input().split()
str = input()

a = ball[0]
b = ball[1]
n = int(num[0])
m = int(num[1])

if str == ball[0]:
    n -= 1
else:
    m -= 1

print(n,m)

Submission status: Accepted

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


def main():

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

    temp = {s: a, t: b}
    temp[u] = temp.get(u) - 1

    return " ".join([str(temp.get(s)), str(temp.get(t))])


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

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:
    ptrint(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('{} {}'.format(a-1,b))
else:
  print('{} {}'.format(a,b-1))

Submission status: Accepted

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

if u == s[0]:
    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(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, raw_input() .split())
A, B = map(int, raw_input() .split())
U = raw_input()
if U == S:
    print A - 1, B
else:
    print A, B - 1

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:
def main():
    s, t = input().split()
    x, y = map(int, input().split())
    if s == input():
        x -= 1
    else:
        y -= 1
    print(x, y)


main()

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())
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:
S,T = input().split()
A,B = map(int,input().split())
U = input()
 
if S == U :
    print("{} {}".format(A-1,B))
else :
    print("{} {}".format(A,B-1))

Submission status: Accepted

Solution code:
def main():
    S,T = input().split()
    A,B = map(int,input().split())
    U = input()
    if U == S :
        print("{0} {1}".format(A-1,B))
    else:
        print("{0} {1}".format(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 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 = input()

if u == s:
    a -= 1
elif u == t:
    b -= 1

print(a, b)

Submission status: Accepted

Solution code:
ST= input().split()
S= str(ST[0])
T= str(ST[1])
AB= input().split()
A= int(AB[0])
B= int(AB[1])
U= input(str(""))

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

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

Submission status: Accepted

Solution code:
s,t = input().split()
a,b = list(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 S == U:
    print(A-1,B)
elif T == U:
    print(A,B-1)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n , m = input().split()
A , B = input().split()
A = int(A)
B = int(B)
T = input()

if (T == n) :
    print (str(A - 1) + " " + str(B))
else :
    print (str(A) + " " + str(B - 1))

Submission status: Accepted

Solution code:
s, t = input ().split ()
a, b = list (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=map(str,input().split())
A,B=map(int,input().split())
U=str(input())
if S==U:
    print(A-1,B)
if T==U:
    print(A,B-1)

Submission status: Accepted

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

print("{} {}".format(a-1, b)) if s == u 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:
    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()
if s == u:
    print(a-1,b)
elif t == u:
    print(a,b-1)
else:
    print(a,b)

Submission status: Accepted

Solution code:
from sys import stdin

def slove():
    S, T = stdin.readline().rstrip().split()
    A, B = [int(x) for x in stdin.readline().rstrip().split()]
    U = input()

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


slove()

Submission status: Accepted

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

balls = dict(zip([s, t], [a, b]))
balls[u] -= 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def q1():
    S,T = (s for s 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('{} {}'.format(A,B))


if __name__ == '__main__':
    q1()

Submission status: Accepted

Solution code:
# ABC 154: A – Remaining Balls
s, t = [s for s in input().split()]
a, b = map(int, input().split())
u = input()

balls = dict(zip([s, t], [a, b]))
balls[u] -= 1

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

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().rstrip()
if u == s:
    print(a-1, b)
else:
    print(a, b-1)

Submission status: Accepted

Solution code:
#coding:utf-8
import sys,os
from collections import defaultdict, deque
from fractions import gcd
from math import ceil, floor
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    XLMIIS = lambda x: [LMIIS() for _ in range(x)]
    YN = lambda c : print('Yes') if c else print('No')
    MOD = 10**9+7

    S,T = input().split()
    A, B = LMIIS()
    num = {}
    num[S] = A
    num[T] = B
    num[input()] -= 1
    print(num[S], num[T])

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S, T = input().split()
a, b = map(int, input().split())
U = input().strip()
print(a - (S == U), b - (T == U))

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:
a, b = map(str, input().split())
c, d = map(int, input().split())
e = input()
if e == a:
	print(c-1,d)
else:
	print(c,d-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:
S,T = (x for x in 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)
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:
s, t = input().split()
a, b = [int(i) for i in input().split()]
u = input()

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