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:
#!/user/bin/env python
#pythonプログラムであることを示している

# -*- coding: utf-8 -*-
"""
このプログラムはPythonを書く際のテンプレとなっています。これをコピペしてコーディングを行なってください。
なお字下げしないこと！！
"""

__author_ = 'Maruta Yuzuha'
__version_ = '1.0.0'
__date__ = '2019/12/25'

def main():
    """
    ここでプログラムの解説を行う
     >>main()
    Hello world.
    0
    """
    s = input().split()
    a = list(map(int, input().split()))
    u = input()
    
    if u == s[0]:
        a[0] -= 1
    else:
        a[1] -= 1
    print(str(a[0])+' '+ str(a[1]))
    return 0

if __name__ == '__main__':
    #上記のifの記述によってこのスクリプトファイルが起動された時だけ実行する部分になる。
    #ちなみにスクリプトが "モジュールとして"インポートされた時には実行されない、

    #単体テスト:モジュールのdocstring(ドキュメンテーション文字列)に記載された全ての対話実行例が書かれている通りに動作するかを確認
    #python ファイル名 -v
    import doctest
    doctest.testmod()

    #実際にmain()を呼び出して、結果を得て、その結果でPythonシステムを終える
    import sys
    sys.exit(main())

Submission status: Accepted

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


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

print(A, B)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input().split()
num = [int(i) for i in input().split()]
u = input()
num1 = num[0]
num2 = num[1]

if s[0] == u:
    nums = num1 - 1
    print("{} {}".format(nums, num2))
elif s[1] == u:
    nums = num2 - 1
    print("{} {}".format(num1, nums))

Submission status: Accepted

Solution code:
strings = input().split(' ')
A = strings[0]
B = strings[1]

strings = input().split(' ')
S = int(strings[0])
T = int(strings[1])

U = input()
  
if A == U:
    print('{0} {1}'.format(S-1, T))
elif B == U:
    print('{0} {1}'.format(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, end=" ")
  print(b)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s,t=input().split()
s_num,t_num=input().split()
s_num,t_num=int(s_num),int(t_num)
string=input()
if s==string:
    s_num-=1
else :
    t_num-=1

print(str(s_num) + ' ' + str(t_num))

Submission status: Accepted

Solution code:
(S, T) = list(map(str, 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 = input().split(' ')[0:2]
A,B = map(int,input().split(' ')[0:2])
U = input()
if U == S:
    A = A - 1
if U == T:
    B = B - 1
print(str(A) + " " + str(B))

Submission status: Accepted

Solution code:
s = input().split()
a = [int(n) for n in input().split()]
b = input()

if b == s[0]:
  a[0] -= 1
elif b == s[1]:
  a[1] -= 1
  
print(a[0], a[1])

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

Submission status: Accepted

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

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

Submission status: Accepted

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

import sys
import math


debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        # for line in sys.stdin:
        #     lines.append(line)
        lines.append(input())
        lines.append(input())
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    (s, t) = [e for e in lines[0].split(" ")]
    (a, b) = [int(e) for e in lines[1].split(" ")]
    u = lines[2]

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


def solve(s, t, a, b, u):
    
    a2 = a
    b2 = b
    if s == u:
        a2 = a2 - 1
    elif t == u:
        b2 = b2 - 1
    
    result = ' '.join([str(a2), str(b2)])

    return result
    


def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()

Submission status: Accepted

Solution code:
s = list(input().split())
a = list(map(int, input().split()))
a[s.index(input())] -= 1
for i in a:
  print(i, end = ' ')

Submission status: Accepted

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

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

print('{0} {1}'.format(b[0],b[1]))

Submission status: Accepted

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

s,t=map(int,input().split())

t1=input()

if t1==b:
    t+=-1
else:
    s+=-1
print(s,t)

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    s,t = LS()
    a,b = LI()
    u = S()
    d = defaultdict(lambda : 0)
    d[0] = a
    d[1] = b
    if s == u:
        d[0] -= 1
    else:
        d[1] -= 1
    print(d[0],d[1])
    return

#Solve
if __name__ == "__main__":
    solve()

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(str(A)+" "+str(B))

Submission status: Accepted

Solution code:
# python3
# -*- coding: utf-8 -*-
import sys
import math
#from math import gcd
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint

INF = float('inf')

ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
sys.setrecursionlimit(1000000000)


def lcm(a, b):
    return (a * b) // gcd(a, b)


# main
S, T = input().split()
A, B = mis()
U = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
colors = input().split()
nums = list(map(int, input().split()))
remover = input()
index = colors.index(remover)
nums[index] -= 1
print("%s %s" % (nums[0], nums[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:


if __name__ == "__main__":
    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(str(A) + " " + str(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(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:
    print(str(A-1) + " " + str(B))
else:
    print(str(A) + " " + str(B-1))

Submission status: Accepted

Solution code:

# 入力
str1,str2=map(str,input().split())
int1,int2=map(int,input().split())
str3=str(input())

# 処理
if str3==str1:
    int1-=1
elif str3==str2:
    int2-=1

# 出力
print(int1,int2)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
color=input().split()
num=list(map(int,input().split()))
b=input()

if b==color[0]:
    num[0]-=1
else:
    num[1]-=1
print(str(num[0])+' '+str(num[1]))

Submission status: Accepted

Solution code:
#A
#入力
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:
a,b = map(str, input().split())
an,bn = map(int, input().split())
s = input()

if a == s:
    print(an-1,bn)
else:
    print(an,bn-1)

Submission status: Accepted

Solution code:
S, T = input().strip().split()
A, B = map(int, input().strip().split())
U = input().strip()
if U==S:
	print(A-1, B)
elif U==T:
	print(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
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()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

Submission status: Accepted

Solution code:
buf=input().split(" ")
S=buf[0]
T=buf[1]
buf=input().split(" ")
A=int(buf[0])
B=int(buf[1])
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())
 
if S == U:
    A -= 1
elif T == U:
    B -= 1
 
ans = [A,B]
print(*ans)

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

reduce = str(input())

for i in range(2):
  if colors[i] == reduce:
    nums[i] -= 1

print(*nums)

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):
  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:
val = input().split(' ')
s = val[0]
t = val[1]

val = input().split(' ')
a = int(val[0])
b = int(val[1])

u = input()

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

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

Submission status: Accepted

Solution code:
s,t = input().split()
n_s, n_t = map(int, input().split())
x = input()
if x == s:
    n_s -= 1
elif x == t:
    n_t -= 1
print(n_s, n_t)

Submission status: Accepted

Solution code:
S,T = input().split()
A,B = list(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:
S, T = [i for i in 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 = input().split(" ")
A, B = input().split(" ")
U = input()

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

Submission status: Accepted

Solution code:
i1 = input()
i2 = input()
i3 = input()

s = i1.split(' ')[0]
t = i1.split(' ')[1]
a = int(i2.split(' ')[0])
b = int(i2.split(' ')[1])
if(i3 == s):
    a -= 1
else:
    b -= 1
print(' '.join([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 = map(int, input().split())
u = input()
res = {
    s: a,
    t: b
}
res[u] -= 1
print(res[s], res[t])

Submission status: Accepted

Solution code:
dic = {}
s, t = input().split()
a, b = input().split()
u = input()
x = int(a)
y = int(b)
if s == u:
    x-=1
elif t == u:
    y-=1
print(x, y)

Submission status: Accepted

Solution code:
args = input().split()
S = args[0]
T = args[1]

args2 = input().split()
a = int(args2[0])
b = int(args2[1])

U = input()

if U == S:
	print(str(a-1)+" "+str(b))
	
else:
	print(str(a)+" "+str(b-1))

Submission status: Accepted

Solution code:
list_input = [input() for i in range(3)]

S_and_T = list_input[0].split(' ')
S = S_and_T[0]
T = S_and_T[1]

A_and_B = list_input[1].split(' ')
A = int(A_and_B[0])
B = int(A_and_B[1])

U = list_input[2]

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

Submission status: Accepted

Solution code:
a=input()
S,T=a.split()[0],a.split()[1]
a=input()
A,B=int(a.split()[0]),int(a.split()[1])
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
else:
  d -= 1
print(str(c)+" "+str(d))

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

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

i = 0
while i <= 1:
    print(b[i], end =' ')
    i = i +1

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
a, b = map(str, input().split())
# スペース区切りの整数の入力
c, d = map(int, input().split())
# 文字列の入力
e = str(input())

if a == e:
    c = c - 1
elif b ==e:
    d = d - 1
    
# 出力
print("{} {}".format(c, d))

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    s = input()
    a = s.split(" ", )
    c, d = map(int, input().split())
    f = input()
    if f  == a[0]:
        c = c-1
    else:
        d = d-1
    print(str(c)+" "+str(d))

Submission status: Accepted

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

a = a - 1 if u == s else a
b = b - 1 if u == t else b
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=A-1
else:
    B=B-1

print(A,B)

Submission status: Accepted

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

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

l = str(nums) + " " + str(numt)
print(l)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
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 operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

s,t=input().split()
a,b=mii()
u=ss()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
rb = input().split()
r = rb[0]
b = rb[1]
AB = input().split()

A = int(AB[0])
B = int(AB[1])

U = input()

if r == U:
  A -= 1
elif b == U:
  B -= 1

print(A,B)

Submission status: Accepted

Solution code:
def resolve_A():
    s1, s2 = input().split()
    n1, n2 = input().split()
    s = input()
    if s == s1:
        n1 = int(n1) - 1
    else:
        n2 = int(n2) - 1
    print(str(n1) + " " + str(n2))
resolve_A()

Submission status: Accepted

Solution code:
# coding: utf-8
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()
sn, tn = list(map(int, input().split()))
take = input()

if take == S:
  print(sn-1, tn)
else:
  print(sn, tn-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)
elif t == u:
  print(a, b-1)

Submission status: Accepted

Solution code:
A,B = input().rstrip().split(" ")
X,Y = map(int,input().rstrip().split(" "))
U = input()
if A == U:
  X -= 1
else:
  Y -= 1
print(str(X) + " " + str(Y))

Submission status: Accepted

Solution code:
st = input()
ab = input()
u = input()

s = st.split(' ')[0]
t = st.split(' ')[1]

a = int(ab.split(' ')[0])
b = int(ab.split(' ')[1])


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

print(a,b)

Submission status: Accepted

Solution code:
S,T = input().split()
s_num,t_num = map(int,input().split())
U = input()
if S==U:
    print(str(s_num-1)+" "+str(t_num))
else:
    print(str(s_num)+" "+str(t_num-1))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
def main():
    StringS,StringT = input().split();
    StringA,StringB = input().split();
    StringU = input();

    wkA=int(StringA);
    wkB=int(StringB);
    if StringU == StringS :
        wkA = wkA - 1;
    else:
        wkB = wkB - 1;
    print(wkA);
    print(wkB);

main()

Submission status: Accepted

Solution code:
S,T = input().split()
ans = list(map(int, input().split()))
c = input()

if c == S:
  ans[0] -= 1
else:
  ans[1] -= 1
print(*ans)

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:
    a -= 1
else:
    b -= 1

print(a,b)

Submission status: Accepted

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

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

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

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

print(str(a) + ' ' + str(b))

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

color = input().split()
a = list(map(int, input().split()))
c = input().strip()
for i, color in enumerate(color):
    if color == c:
        a[i] -= 1

a = list(map(str, a))
print(' '.join(a))

Submission status: Accepted

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




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

lists=[A,B]
print(*lists)

Submission status: Accepted

Solution code:


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

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




print(a,b)

Submission status: Accepted

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

Submission status: Accepted

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


def solve(S: str, T: str, A: int, B: int, U: str):
    dictionary = {S: A, T: B}
    dictionary[U] = dictionary[U] - 1
    print("{0} {1}".format(dictionary[S], dictionary[T]))
    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:
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:
S,T=(str(x) for x in input().split())
a,b=(int(x) for x in 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:
a,b=input().split()
c,d=map(int,input().split())
e=input()
if e==a:
  c-=1
else:
  d-=1
print(c,d)

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)
elif U == T:
    print(A, B-1)
else:
    print('Invalid string.')

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**9)
from collections import defaultdict

IA = lambda: map(int,input().split())
IAS= lambda: map(str,input().split())

s=list(IAS())
n=list(IA())
u=input()

for i in range(0,2):
    if s[i]==u:
        n[i]-=1
print(str(n[0])+" "+str(n[1]))

N=int(100005)
a=[int(0) for i in range(N)]

Submission status: Accepted

Solution code:
a = input().split(" ")
b = list(map(int, input().split(" ")))
c = input()
if (a[0] == c):
  print("{0} {1}".format(b[0]-1, b[1]))
elif (a[1] == c):
  print("{0} {1}".format(b[0], b[1]-1))

Submission status: Accepted

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

Submission status: Accepted

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

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 -= 1
else:
    B -= 1
print("{} {}".format(A,B))

Submission status: Accepted

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

dict = {a:na, b:nb}
dict[c] -=1

print('{0} {1}'.format(dict[a], dict[b]))

Submission status: Accepted

Solution code:
a, b = map(str, input().split())
n_a, n_b = map(int, input().split())
s_u = str(input())
s_a = 1 if a == s_u else 0
s_b = 1 - s_a
out = "{0} {1}".format(n_a - s_a, n_b - s_b)
print(out)

Submission status: Accepted

Solution code:
class Ball():
    def __init__(self, S: str, T: str, A: int, B: int):
        self.S = S
        self.T = T
        self.A = A
        self.B = B

    def select_ball(self, U: str):
        if self.S == U:
            self.A -= 1
        else:
            self.B -= 1
        return

    def remain_balls(self):
        print(self.A, self.B)


S, T = input().split(" ")
A, B = [int(i) for i in input().split(" ")]
U = input()

ball = Ball(S, T, A, B)
ball.select_ball(U)
ball.remain_balls()

Submission status: Accepted

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

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

print(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:
# -*- coding: utf-8 -*-
import numpy as np

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
input_line = input()
S,T = input_line.split(" ")
input_line = input()
tmpA,tmpB = input_line.split(" ")
Sval = int(tmpA)
Tval = int(tmpB)
U = input()

if(U == S):
  Sval = Sval - 1
elif(U == T):
  Tval = Tval - 1
print(Sval,Tval)

Submission status: Accepted

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

if u == s:
    print(s_num - 1, t_num)
else:
    print(s_num, t_num- 1)

Submission status: Accepted

Solution code:
def Main(S, T, A, B, U):
    if(U == S):
        return str(A-1) + " " + str(B)
    else:
        return str(A) + " " + str(B-1)

def main():
    S, T = list(map(str, input().split()))
    A, B = list(map(int, input().split()))
    U = str(input())
    print(Main(S, T, A, B, U))

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

Submission status: Accepted

Solution code:
def average_length(s, t, a, b, u):
    if u == s:
        return str(a - 1) + ' ' + str(b)
    elif u == t:
        return str(a) + ' ' + str(b - 1)
    return

if __name__ == "__main__":
    s, t = map(str, input().split())
    a, b = map(int, input().split())
    u = input()
    print(average_length(s, t, a, b, u))

Submission status: Accepted

Solution code:
Input1 = input().split(" ")
Input2 = input().split(" ")
Input3 = input()
Dict = {}
Dict[Input1[0]] = int(Input2[0])
Dict[Input1[1]] = int(Input2[1])
Dict[Input3] -= 1
print("{0} {1}".format(Dict[Input1[0]],Dict[Input1[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-=1
else:
	b-=1
print(a,b)

Submission status: Accepted

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


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