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:
from sys import stdin

s, t = stdin.readline().rstrip().split()
a, b = [int(x) for x in stdin.readline().rstrip().split()]
u = input()

if (u in s):
    print(str(a - 1) + ' ' + str(b))
elif (u in t):
    print(str(a) + ' ' + str(b - 1))
else:
    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 = A - 1
else:
    B = B - 1

print(A, B)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
x_name, y_name = input().split()
x_sum, y_sum = (int(x) for x in input().split())
z = input()
if x_name == z:
  x_sum -= 1
elif y_name == z:
  y_sum -= 1
print(str(x_sum) + " " + str(y_sum))

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 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:
#!/usr/bin/env python3

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

Submission status: Accepted

Solution code:
A,B = input().split()
n_A, n_B = input().split()
num_A = int(n_A)
num_B = int(n_B)
C = input()
if C == A:
  num_A = num_A -1
if C == B:
  num_B = num_B -1
print(num_A, num_B)

Submission status: Accepted

Solution code:
st = input().split()
ab = list(map(int, input().split()))
u = input()
ab[st.index(u)] -= 1
print(ab[0],ab[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 = [int(num) for num in input().split()]
U = (input())
if S == U:
    print("{} {}".format(A-1, B))
else:
    print("{} {}".format(A, B-1))

Submission status: Accepted

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

aa, bb = map(int, input().split())

set = input()

if set == a:
    aa -= 1
else:
    bb -= 1

print(str(aa) + " " +str(bb))

Submission status: Accepted

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

str_1,str_2 = input().split()
str_1_count,str_2_count = input().split()
del_str = input()
if del_str == str_1:
    str_1_count = int(str_1_count) - 1
else:
    str_2_count = int(str_2_count) - 1

print(str(str_1_count) +" " + str(str_2_count))

Submission status: Accepted

Solution code:
S,T = input().split()
s_num,t_num = (int(x) for x in input().split())
U = input()

if U == S:
  print(s_num-1,t_num)
elif U == T:
  print(s_num,t_num-1)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
mod=1000000007

#+++++

def main():
	a, b = input().split()
	v,w = IN()
	ss=input()
	if ss == a:
		v=v-1
	else:
		w=w-1
		
	print(str(v)+' '+str(w))
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Submission status: Accepted

Solution code:
import sys

Ball = list(map(str, input().split()))
Quantity = list(map(int,input().split()))
U = str(input())

S = Ball[0]
T = Ball[1]
A = Quantity[0]
B = Quantity[1]

if not 1 <= len(S) or not len(S) <= 10:
    print("error:S_length")
    sys.exit()    
if not 1 <= len(T) or not len(T) <= 10:
    print("error:T_length")
    sys.exit()   
if S == T:
    print("error:S==T")
    sys.exit()
if S != U and T != U:
    print("error:S=U or S=T")
    sys.exit()
if not 1<= A or not B <= 10:
    print("error:A,B")
    sys.exit()

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:
  A = A - 1
else:
  B = B - 1
print(A, B)

Submission status: Accepted

Solution code:
a,b = input().split()
a_num, b_num = map(int, input().split())
x = input()

if x==a :
    a_num = a_num - 1
else:
    b_num = b_num - 1

print(str(a_num) + " " + str(b_num))

Submission status: Accepted

Solution code:
r,b = input().split()
num1,num2 = map(int,input().split())
u = input()
a = num1
b = num2
if u == r:
    a = num1-1
else :
    b = num2-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(A, B)

Submission status: Accepted

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

if u == s[0]:
    print(a[0]-1, a[1])
else:
    print(a[0], a[1]-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(str(A) + " " + str(B) )

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, k=input().split()
l, m= map(int, input().split())
o = input()
if n==o:
	l = l-1
if k == o:
	m = m-1
print(l,m)

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:
#!/usr/bin/env python3

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

Submission status: Accepted

Solution code:
ball_name1,ball_name2 = input().split(" ")
ball1,ball2 = input().split(" ")
ball1 = int(ball1)
ball2 = int(ball2)
ball_chosen = input()


if (ball_chosen in ball_name1) :
    ball1-=1
    print(str(ball1)+" "+str(ball2))
else:
    ball2-=1
    print(str(ball1)+" "+str(ball2))

Submission status: Accepted

Solution code:
col = input().split()
num = list(map(int, input().split()))
col2 = input()

if col[0] == col2:
  print(num[0] - 1, num[1])
elif col[1] == col2:
  print(num[0], num[1] - 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, B, sep=' ')

Submission status: Accepted

Solution code:
s,t=map(str, input().split())
a,b=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=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:
a, b = input().split()
c, d = map(int, input().split())
e = input()

if e == a: c-= 1
elif e == b: d -= 1

print(c, d)

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 =  [str(x) for x in input().split()]

A , B =  [int(x) for x in input().split()]

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

Submission status: Accepted

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

    temp1 = s.count(s)
    temp2 = t.count(t)
    temp3 = u.count(u)
    temp1 = a
    temp2 = b
    if u == s:
        a = temp1 - temp3
        print(a, b)
    elif u == t:
        b = temp2 - temp3
        print(a, b)
    else:
        pass


remaining_balls()

Submission status: Accepted

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


def solve(S: str, T: str, A: int, B: int, U: str):
    print(str(A-1) + " " + str(B) if U == S else str(A) + " " + str(B-1))
    return


# 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:
p=[input() for i in range(3)]
col=list(map(str, p[0].split()))
cnt=list(map(int, p[1].split()))
c_del=p[2]
if c_del in col:
    ball=cnt[col.index(c_del)]
    del cnt[col.index(c_del)]
    ball-=1
    cnt.insert(col.index(c_del),ball)
print(' '.join(map(str,cnt)))

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
else:
  pass

print(a)
print(b)

Submission status: Accepted

Solution code:
i = input().split()
j = list(map(int, input().split()))
k = input()
if k==i[0]:
    j[0]=j[0]-1
else:
    j[1]=j[1]-1
print(j[0], j[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()

if U == S:
  A -= 1
else:
  B -= 1
  
print(A, end=' ')
print(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),
print(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:
# Remaining Balls
S, T = tuple(input().split(' '))
A, B = tuple(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
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

S, T = readline().split()
A, B = map(int, readline().split())
U = read().rstrip()

if S == U:
    A -= 1
else:
    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("{} {}".format(a,b))

Submission status: Accepted

Solution code:
S = input().split()
A = list(map(int, input().split()))
Z = input()
 
if S[0] == Z:
  X = A[0] - 1
  Y = A[1]
  print("{} {}".format(X, Y))
if S[1] == Z:
  X = A[0]
  Y = A[1] - 1
  print("{} {}".format(X, Y))

Submission status: Accepted

Solution code:
d1 = input().split()
d = input().split()
d3 = input()
d2 = [int(x) for x in d]

if d1[0]==d3:
    d2[0]-=1
elif d1[1]==d3:
    d2[1]-=1


for x in d2:
    print(x)

Submission status: Accepted

Solution code:
input_lines = input().split()
numbers = list(map(int,input().split()))
line = input()

if line == input_lines[0]:
    numbers[0] -= 1
else :
    numbers[1] -= 1

numbers = list(map(str,numbers))
print(numbers[0] + ' ' + numbers[1])

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/python3
 
cmdvar_str=input()
cmdvar_num=input()
strchois=input()
str_splited=cmdvar_str.split()
num_splited=cmdvar_num.split()

if strchois == str_splited[0]:
    print(int(num_splited[0])-1,num_splited[1])
if strchois == str_splited[1]:
    print(num_splited[0],int(num_splited[1])-1)

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("%d %d" % (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=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 = list(map(str,input().split()))
A,B = list(map(int,input().split()))
U = input()

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

print(A,' ',B,sep='')

Submission status: Accepted

Solution code:
S, T = input().split()
A, B = map(int, input().split())
U = input()
if U == S:
    A = A - 1
elif U == T:
    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())

s_count = A
t_count = B

if(U == S):
  s_count -= 1
else:
  t_count -= 1
  
print(s_count)
print(t_count)

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, end=" ")
  print(B)
else:
  print (A, end=" ")
  print(B-1)

Submission status: Accepted

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

Submission status: Accepted

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

print(-(s==u)+a,-(t==u)+b);

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:
strArr = input().split()
numArr = input().split()
nums = [int(s) for s in numArr]
which = input()
if (which == strArr[0]):
  print(str(nums[0] - 1) + " " + str(nums[1]))
else:
  print(str(nums[0]) + " " + str(nums[1] - 1))

Submission status: Accepted

Solution code:
c1,c2 = input().split()
a1,a2 = input().split()
tem = input()
a1 = int(a1)
a2 = int(a2)
if tem == c1:
   a1 = a1-1
else:
   a2 = a2 -1

print(str(a1)+" "+ str(a2))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = input().split()
b = input().split()
c = input()
if c == a[0]:
  b[0] = int(b[0])-1
elif c == a[1]:
  b[1] = int(b[1])-1
j = ""
for i in b: 
  j = j + " " + str(i)
print(j)

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


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

print(a+' '+b)

Submission status: Accepted

Solution code:
s, t = input().split()
x, y = map(int, input().split())
query = input()
if query == s:
    x -= 1
else:
    y -= 1
print("{} {}".format(x, y))

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("{} {}".format(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()
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 = input().split()
U = input()
A, B = int(A), int(B)

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

print(A, B)

Submission status: Accepted

Solution code:
a,b = input().split()
n,m = list(map(int,input().split()))
k=input()
print(n-(a==k),m-(b==k))

Submission status: Accepted

Solution code:
a,b = input().split()
A,B = input().split()
c = input()
a = str(a)
b = str(b)
A = int(A)
B = int(B)
c = str(c)
d = A - 1
D = B - 1
if c == a:
    print(d,B)
elif c == b:
    print(A,D)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
strl = input().split()
qty = list(map(int, input().split()))
str = input()

if strl[0] == str:
    qty[0] = qty[0] - 1
else:
    qty[1] = qty[1] - 1

print(qty[0], qty[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(list,input().split())
A,B=map(int,input().split())
U=list(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 = str(input())
if U == T:
    B-=1
else:
    A-=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("{} {}".format(a-1,b))
else:
    print("{} {}".format(a,b-1))

Submission status: Accepted

Solution code:
li = input().split()
count = input().split()
ch = input()

for i in range(len(li)):
  if li[i] == ch:
    count[i] = int(count[i]) - 1
  else:
    count[i] = int(count[i])
    
print(count[0],count[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
else:
  B -= 1

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

Submission status: Accepted

Solution code:
s, t = input().split()
s_val, t_val = map(int, input().split())
key_name = input()
if key_name == s:
    s_val -= 1
else:
    t_val -= 1
print(s_val, t_val)

Submission status: Accepted

Solution code:
S = input().split()
num = [int(x) for x in input().split()]
A = input()
 
if A == S[0]:
  num[0]=num[0]-1
else:
  num[1]= num[1]-1
  
print(str(num[0])+" "+str(num[1]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input().split()
i = list(map(int, input().split()))
a=input()
if a==s[0]:
  i[0]-=1
elif a==s[1]:
  i[1]-=1
print(i[0],i[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
   
else :
    b = b-1

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

Submission status: Accepted

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


resolve()

Submission status: Accepted

Solution code:


s, t= [""] * 2
a, b = [0] * 2
u = [""]

def format_input(filename = None):
	global s,t
	global a,b
	global u
	if filename == None:
		s, t = list(map(str, input().split()))
		a, b = list(map(int, input().split()))
		u = list(map(str, input().split())).pop()

def get_answer():
	answer = [a, b]
	if u == s:
		answer[0] -= 1
	else:
		answer[1] -= 1

	return answer

if __name__ == '__main__':
	format_input()

	ans = get_answer()
	print(ans[0], ans[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:
  a -= 1
elif u == t:
  b -= 1
print('{0} {1}'.format(a,b))

Submission status: Accepted

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

def main():
  s, t = input().strip().split()
  a, b = map(int, input().strip().split())
  u    = input().strip()
  if u == s:
    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 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:
    print(A-1,B)
else:
    print(A,B-1)

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
elif T == U:
	B -= 1
print A, B

Submission status: Accepted

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

Submission status: Accepted

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


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

Submission status: Accepted

Solution code:
a,b = map(str,input().split())
a_num,b_num = map(int,input().split())
change = input()
if a == change:
    a_num = a_num - 1
else:
    b_num = b_num - 1
print(str(a_num)+" "+str(b_num))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
s = input().split()
n = list(map(int,input().split()))
s2 = input()

if s[0] == s2:
  n[0] = n[0] - 1
else:
  n[1] = n[1] - 1

print(str(n[0]) +' '+str(n[1]))

Submission status: Accepted

Solution code:
r1 = input().split(" ")
s = r1[0]
t = r1[1]
r2 = list(map(int,input().split(" ")))
a = r2[0]
b = r2[1]
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 = [int(i) for i in input().split()]
U = input()

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

print(A, B)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s, t = map(str,input().split())
num_s, num_t = map(int,input().split())
del_target = input()


data  = {s:num_s,t:num_t}
data[del_target] = data[del_target]-1

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

Submission status: Accepted

Solution code:

# -*- coding: utf-8 -*-
"""
Created on Sun Feb  9 20:19:26 2020

@author: W_Indicate
"""
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:
# abc154

s,t = input().split()
n,m = map(int,input().split())
u = input()

if u == s:
    n -= 1
elif u == t:
    m -= 1
else:
    print(-1)

print(n,m)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
word_list = [i for i in input().split()]
num_list = [int(num) for num in input().split()]
ext_word = input()

check_dict = dict(zip(word_list, num_list))
check_dict[ext_word] -= 1

check_list = [str(check_dict[key_val]) for key_val in word_list]
print(check_list[0] + " " + check_list[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:
    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(a-1, b)
elif u == t:
    print(a, b-1)
else:
    print(a, b)

Submission status: Accepted

Solution code:
ST = input().split()
AB = list(map(int, input().split()))
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:
#s,t
s = input().split()

#a,b
a= list(map(int, input().split()))

#u
u = input()

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

print(str(a[0]),str(a[1]))

Submission status: Accepted

Solution code:
color = input().split()
num = input().split()
choice = input()

for i in range(2):
  num[i] = int(num[i])
  if color[i] == choice:
    num[i] = num[i] - 1
print(num[0], num[1])

Submission status: Accepted

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

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

solve()

Submission status: Accepted

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

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

U = input()

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

Submission status: Accepted

Solution code:
def resolve():
    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))


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
S,T =input().split()
s,t = (int(x) for x in input().split())
U = input()
if(U == S):
    s= s-1
elif(U == T):
    t = t-1
print(s,t)

Submission status: Accepted

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

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

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