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 = list(map(int, input().split()))
u = input()

if s_t[0]==u:
  a_b[0]-=1
else:
  a_b[1]-=1
  
print(a_b[0], 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())
x=input()
##print(s, t, a, b, x)

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

if u==s:
    a -= 1
if 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:
  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 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 U == S:
    A = A-1
else:
    B = B-1
print(A, B)

Submission status: Accepted

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

if U==S:
  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:
  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 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

print(a, b)

Submission status: Accepted

Solution code:
[S,T]=list(input().split())
[A,B]=map(int,list(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:
  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 -=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=map(str,input().split())
A,B=map(int,input().split())
U=str(input())

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

print(A,B)

Submission status: Accepted

Solution code:
str_list = input().rstrip().split(' ')
num_list = input().rstrip().split(' ')
output = input().rstrip().split(' ')[0]
target_index = str_list.index(output)
num_list[target_index] = int(num_list[target_index]) - 1

out_str = ''
for i, num in enumerate(num_list):
  out_str += str(num)
  if i != len(num_list) - 1:
    out_str += ' '
print(out_str)

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

Submission status: Accepted

Solution code:
ST = input().split(" ")
AB = input().split(" ")
AB = [int(i) for i in AB]
U = input()
if U ==ST[0]:
    AB[0] -= 1
else:
    AB[1] -= 1
print(str(AB[0])+" "+str(AB[1]))

Submission status: Accepted

Solution code:
color=input().split()
x,y=map(int,input().split())
color2=input()

if color2==color[0]:
    print(x-1,y)
else:
    print(x,y-1)

Submission status: Accepted

Solution code:
color=input().split()
x,y=map(int,input().split())
color2=input()

if color2==color[0]:
    print(x-1)
    print(y)
else:
    print(x)
    print(y-1)

Submission status: Accepted

Solution code:
c1, c2 = input().split()
b1, b2 = map(int, input().split())
u = input()

if (u == c1):
    b1 -= 1
else:
    b2 -= 1

print(b1,b2)

Submission status: Accepted

Solution code:
s,t = raw_input().split()
a,b = map(int, raw_input().split())
u = raw_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 s==u:
    a=a-1
else:
    b=b-1
print(str(a)+" "+str(b))

Submission status: Accepted

Solution code:
red,blue=input().split()
a,b=(int(x) for x in input().split())
dic={red:a,blue:b}
u=input()
dic[u]-=1
print(str(dic[red])+" "+str(dic[blue]))

Submission status: Accepted

Solution code:
x, y = input().strip().split()
a, b = [int(i) for i in input().strip().split()]
z = input().strip()
if z == x: a -= 1
else: b -= 1
print(a, b)

Submission status: Accepted

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

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

print(ans1, ans2)

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

Submission status: Accepted

Solution code:
S, T = input().split()
A, B = map(int, input().split())
dict = {S: A, T: B}
U = input()
dict[U] = 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 S == U:
  A = A - 1
else:
  B = B - 1
print(' '.join(map(str, [A, B])))

Submission status: Accepted

Solution code:
components =input().rstrip().split(" ")
numbers=input().rstrip().split(" ")
decrease =input()
dictionary ={components[0]:numbers[0],components[1]:numbers[1]}
#print(dictionary)
(dictionary[decrease])=int(dictionary[decrease])-1
print(dictionary[components[0]],dictionary[components[1]])

Submission status: Accepted

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

if s==u:
    a=a-1

elif t==u:
    b=b-1

print(a)
print(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 =input().split()
A = int(a)
B = int(b)
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:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    S,T=ST().split()
    A,B=MI()
    U=ST()
    print(A-(U==S), B-(U==T))
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 :
    print(a-1, b)
else:
    print(a, b-1)

Submission status: Accepted

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

    print('{} {}'.format(a-1, b) if s == u else '{} {}'.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 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:
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:
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:
str1, str2 = input().split()
num1, num2 = map(int,input().split())
trim = input()
 
if trim == str1:
	num1 = num1 - 1
else:
  	num2 = num2 - 1
 
print("%d %d"  %(num1, num2))

Submission status: Accepted

Solution code:
s,b = input().split()
d = {}
d[s],d[b] = [int(x) for x in input().split()]
d[input()] -= 1
print(d[s],d[b])

Submission status: Accepted

Solution code:
s, t = input().split(" ")
n_s, n_t = input().split(" ")
u = input()
bag = {s:int(n_s), t:int(n_t)}
bag[u] -= 1
print("{} {}".format(bag[s], bag[t]))

Submission status: Accepted

Solution code:
moji = list(map(str,input().split()))
kazu = list(map(int,input().split()))
U = input()
kazu[moji.index(U)] -= 1
print(kazu[0],kazu[1])

Submission status: Accepted

Solution code:
c = input().split()
n = [int(c) for c in input().split()]
idx = c.index(input())
n[idx] -= 1
print(" ".join([str(c) for c in n]), end="\n")

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,b=[i for i in input().split()]
n,m=[int(i) for i in input().split()]
s=input()
if s == a:
  n-=1
else:
  m-=1
print(n,m)

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))
else:
  print(str(A) + ' ' + str(B-1))

Submission status: Accepted

Solution code:
balls = input()
nums  = input()
removed=input()

balls = balls.split()
nums  = nums.split()

if balls[0] == removed:
  nums[0] = int(nums[0]) - 1
  nums[1] = int(nums[1])
else:
  nums[0] = int(nums[0])
  nums[1] = int(nums[1]) - 1

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

Submission status: Accepted

Solution code:
s, t = (z for z in input().split())
a, b = (int(z) for z in 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())
b1, b2 = map(int, input().split())
u = input()
if u == s:
  b1 -= 1
else:
  b2 -= 1
print("{} {}".format(b1, b2))

Submission status: Accepted

Solution code:
alc = input().split()
nums = list(map(int, input().split()))
choose = input()

ans0 = nums[0] - int(alc[0]==choose)
ans1 = nums[1] - int(alc[1]==choose)
print(ans0, ans1)

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 = 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 = list(map(int, input().split()))
U = input()

Count = {S:A, T:B}
Count[U] -= 1

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

Submission status: Accepted

Solution code:
import sys
import socket

hostname = socket.gethostname()

if hostname == 'F451C':
    sys.stdin = open('a1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    S, T = read_str_list()
    A, B = read_int_list()
    U = read_str()
    if U == S:
      res = A - 1, B
    elif U == T:
      res = A, B - 1
    print(res[0], res[1])


main()

Submission status: Accepted

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

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:
a = input().split()
 
b = [int(x) for x in input().split()]
 
c = input()
 
if c == a[0]:
  b[0]-=1
elif c == a[1]:
  b[1]-=1
 
if b[0] < 0:
  b[0] = 0
if b[1] < 0:
  b[1] = 0
print("{} {}".format(*b))

Submission status: Accepted

Solution code:
inp = list(map(str, input().split()))
S = inp[0]
T = inp[1]
inp = list(map(int, input().split()))
A = inp[0]
B = inp[1]
U = str(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 = a - 1
else:
  b =  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 -= 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 = input().split()
a,b = map(int,input().split())
u = input()

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

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

Submission status: Accepted

Solution code:
def solve(string):
    s, t, a, b, u = string.split()
    return "{} {}".format(int(a) - (s == u), int(b) - (t == u))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))

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:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#solve
def solve():
    s,t = LS()
    a,b = LI()
    u = S()
    if s == u:
        print(a - 1, b)
    else:
        print(a, b - 1)
    return


#main
if __name__ == '__main__':
    solve()

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

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

    print(a,b)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S, T = input().split()
s, t = map(int, input().split())
U = input()

if S == U:
    print(s - 1, t)
else:
    print(s, t - 1)

Submission status: Accepted

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

Submission status: Accepted

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


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    s = input().split()
    n, m = list(map(int, input().split()))
    d = input()
    #print(s)
    if s[0] == d:
        print(n - 1, m)
    else:
        print(n, m - 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("{} {}".format(a-1, b))
else:
    print("{} {}".format(a, b-1))

Submission status: Accepted

Solution code:
color = input().split() #s_1 s_2を分割して取得し、colorに値を入れる
count = list(map(int, input().split())) #i_1 i_2を取得し、countに値を入れる
select_color = input() # 玉の色を選択

for i in range(0, 2):
    if select_color == color[i]:
        count[i] -= 1
print(count[0], count[1]) #残りの個数を出力

Submission status: Accepted

Solution code:
ab = list(input().split())
cd = list(map(int,input().split()))
if input() == ab[0]:
  cd[0] -=1
else:
  cd[1] -=1

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

Submission status: Accepted

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

res[S] = A
res[T] = B

res[U] = res[U] - 1

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

Submission status: Accepted

Solution code:
ST = input().split()
AB = list(map(int, input().split()))
U = input()

AB[ST.index(U)] -= 1
print(' '.join(map(str, AB)))

Submission status: Accepted

Solution code:
S, T = 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()
x,y=map(int,input().split())
ss=input()
if ss==s:
    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 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:
    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().strip()

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

Submission status: Accepted

Solution code:

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

b = input()
bb = b.split()
b0 = int(bb[0])
b1 = int(bb[1])

c = input()

if c == aa[0]:
    b0 -= 1
else:
    b1 -= 1
    
print(b0,b1)

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 = [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:
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:
colors = list(input().split(" "))
cnt = list(map(int,input().split(" ")))

s = input()
if s == colors[0]:
    cnt[0] -=1
else:
    cnt[1] -=1
print(" ".join(map(str,cnt)))

Submission status: Accepted

Solution code:
#abc154a
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:
def solve(s, t, a, b, u):
    t = s == u
    return "%d %d" % (a - t, b - 1 + t)

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

Submission status: Accepted

Solution code:
from collections import OrderedDict as dict
d = dict(zip(input().split(), map(int, input().split())))
d[input()] -= 1
print(*d.values())

Submission status: Accepted

Solution code:
s,t=input().split()
a,b=map(int,input().split())
c=input()
d=" "
if s==c:
  print("{}""{}""{}".format(a-1,d,b))
else:
  print("{}""{}""{}".format(a,d,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(a, b)

Submission status: Accepted

Solution code:
s, t = list(input().split())
s_num, t_num = map(int, input().split())
bad_string = input()

if bad_string == s:
    print(s_num - 1, t_num)
elif bad_string == t:
    print(s_num, t_num - 1)
else:
    print(s_num, t_num)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
ball_1,ball_2 = input().split()
ball_1_count,ball_2_count = map(int , input().split())
getted_str = input()
if getted_str == ball_1:
    ball_1_count -= 1
else:
    ball_2_count -= 1
print(str(ball_1_count) + " " + str(ball_2_count))

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(A, B)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

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:
    print(str(a-1)+" "+str(b))
else:
    print(str(a)+" "+str(b-1))

Submission status: Accepted

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

if S==U:
    print(s-1,t)
elif T==U:
    print(s,t-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)
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()
if S == U:
    A = A - 1
elif T == U:
    B = B - 1
print("{} {}".format(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 U == S:
    print(A-1, B)
else:
    print(A, B-1)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
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:
def getList():
    return list(map(int, input().split()))
  
s,t = input().split()
a, b = getList()
u = input().strip()
 
if s == u:
  print(a-1 ,b)
else:
  print(a, b-1)

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
from collections import deque

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

s, t = list(map(str, stdin.readline().split()))
a, b = na()
u = ns()
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:
    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:
    A = A - 1
elif U == T:
    B = B - 1
print(A,B)

Submission status: Accepted

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

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

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('{} {}'.format(A, B))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

a = int(a)
b = int(b)

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:
  A -= 1

if T == U:
  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()))
    if s == str(readline().rstrip().decode('utf-8')):
        print(a - 1, b)
    else:
        print(a, b - 1)


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# A - Remaining Balls
s,_ = input().split()
a,b = map(int, input().split())
print(*[[a,b-1],[a-1,b]][s==input()])

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, math
def input():
    return sys.stdin.readline()[:-1]
from itertools import permutations, combinations
from collections import defaultdict, Counter
from math import factorial

sys.setrecursionlimit(10**7)
S, T = input().split()
A, B = map(int, input().split())
s = input()

if s == 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 = input().split(' ')
#a, b = [int(x) for x in 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(x) for x in 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(str(a) + " " + str(b))

Submission status: Accepted

Solution code:
# A - Remaining Balls
s,t = input().split()
a,b = map(int, input().split())
u = input()
print(*[[a,b-1],[a-1,b]][u==s])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
s, t = input().split()
# スペース区切りの整数の入力
a, b = map(int, input().split())

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