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

Submission status: Accepted

Solution code:
s,a,u=open(0);i=u in s;print(int(a[:2])-1+i,int(a[2:])-i)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s_lis = input().split()
n_lis = list(map(int, input().split()))
s = input()
if s_lis[0] == s:
    n_lis[0] -= 1
else:
    n_lis[1] -= 1
print(*n_lis)

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

Submission status: Accepted

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

if U == S:
  A -= 1
else:
  B -= 1
print(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:
n , m = map(str , input() . split())
n1 , m1 = map(int , input() . split())
s = input()
if s == n :
    print(n1 - 1 , m1)
elif s == m:
    print(n1 , m1 - 1)

Submission status: Accepted

Solution code:
def remain(S, T, A, B, U):
  if U == S:
    A -= 1
  elif U == T:
    B -= 1
  return (A, B)

S, T = input().split()
A, B = list(map(int, input().split()))
U = input()
A, B = remain(S, T, A, B, U)
print(A, B)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S=input().split()
a=[int(e) for e in input().split()]
U=input()

if(S[0]==U):
    a[0]=a[0]-1
if(S[1]==U):
    a[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()

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

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

Submission status: Accepted

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

Submission status: Accepted

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

if u == s:
    a -= 1
elif u == t:
    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 = input()

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

Submission status: Accepted

Solution code:
import numpy
s, t = input().split()
ab = numpy.array(list(map(int,input().split())))
u = input()

if u == s:
	ab=ab - [1, 0]
else:
	ab=ab - [0, 1]
	
print(*ab)

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:
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:
(red, blue) = list(input().split())
(p, q) = list(map(int, input().split()))
st = input()

if red == st:
  print( str(p-1)+ " " +str(q) )
else:
  print( str(p)+ " " +str(q-1) )

Submission status: Accepted

Solution code:
color = input().split()
number = list(map(int,input().split()))
choice = str(input())
 
for i in [0,1]:
  if choice == color[i]:
    number[i] -= 1
    
print(number[0],number[1])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 17 10:26:25 2020

@author: 17664
"""

balls = {}
s, t = input().split()
balls[s], balls[t] = [int(num) for num in input().split()]
balls[input()] -= 1

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# https://atcoder.jp/contests/abc154/tasks/abc154_a

s, t = input().split()
a, b = [int(x) for x in input().split()]
u = input()
if s == u:
    a -= 1
if t == u:
    b -= 1
print(a, b)

Submission status: Accepted

Solution code:
from sys import stdin


def get_result(data):
    S, T = data[0]
    A, B = data[1]
    U = data[2][0]
    if S == U:
        A = A - 1
    elif T == U:
        B = B - 1
    return ' '.join([str(A), str(B)])

if __name__ == '__main__':
    raw_data = [val.rstrip('\n') for val in stdin.readlines()]
    data = [list(map(str, val.split(' '))) for val in raw_data]
    data[1] = [int(val) for val in data[1]]
    result = get_result(data)
    print(result)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# import numpy as np
# import scipy as sp
# print(a,b,c,sep="") # 半角スペースなしで出力(abc)
# n=int(input())  #数値入力 「N」だけの入力のとき
# a,b=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
# a=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
# a=[int(input()) for _ in range (n)]  #リスト入力  改行でa1 ... anのとき
# s=[list(map(str,list(input()))) for i in range(h)]  # 文字列の二次元配列入力
# s = [list(map(int, input().split())) for i in range(n)] # 数値の二次元配列入力
# a = b[:], a = [x[:] for x in b] # deepcopy
# chr(ord('a') + 1) # chrのインクリメント
# s.sort(key=lambda x: x[1], reverse=False) # 2番目の要素で昇順にソート（Trueなら降順）
#
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 = list(map(int,input().split()))
U = input()
 
if U == S:
  print("{} {}".format(A-1,B))
else:
  print("{} {}".format(A,B-1))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

data = {
    str(S): A,
    str(T): B,
}

data[str(U)] -= 1

s = data[str(S)]
t = data[str(T)]
print('{} {}'.format(s, t))

Submission status: Accepted

Solution code:
ss=input().split()
a,b=list(map(int,input().split()))
s=input()
if s==ss[0]: print(a-1,b)
elif s==ss[1]:print(a,b-1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s, t = 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:
# ANSHUL GAUTAM
# IIIT-D

from math import *
from copy import *
from string import *				# alpha = ascii_lowercase
from random import *				# l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference
from sys import stdin
from sys import maxsize
from operator import *				# d = sorted(d.items(), key=itemgetter(1))
from itertools import *
from collections import Counter		# d = dict(Counter(l))
from collections import defaultdict # d = defaultdict(list)

'''

'''

def solve(l):
	n = len(l)
	

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

Submission status: Accepted

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

if U == ball[0]:
    number[0] -= 1
else:
    number[1] -= 1
print(number[0], number[1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
sp=input().split()
A,B=list(map(int,input().split()))
s=input()
if sp[0]==s:print(A-1,B)
elif sp[1]==s:print(A,B-1)

Submission status: Accepted

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

if a == e:
    print(c - 1, d)
else:
    print(c, d - 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)
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,end=' ')
	print(b)
elif u == t:
	print(a, end=' ')
	print(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:
def remaining_ball():
    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)
remaining_ball()

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    a,b = LS()
    c = LI()
    d = S()
    if d == a:
        c[0] -= 1
    elif d == b:
        c[1] -= 1

    return JA(c, " ")


print(main())

Submission status: Accepted

Solution code:
ar = input().split(" ")
br = list(map(int,input().split(" ")))
c = input()
if c == ar[0]:
    br[0] -= 1
else:
    br[1] -= 1
print(br[0],br[1])

Submission status: Accepted

Solution code:
a, b = input().split(' ')
c, d = map(int, input().split(' '))
e = input()

if a == e:
  c = c - 1
else:
  d = d - 1
  
print(c, d)

Submission status: Accepted

Solution code:
s,t=map(str,input().split())
n,m=map(int,input().split())
ss=input()
if s==ss:
  print(n-1,m)
else:
  print(n,m-1)

Submission status: Accepted

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

if u == s :
    a -= 1
elif u == t :
    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)
    return


main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = raw_input().split()
a, b = map(int, raw_input().split())
x = raw_input().strip()
if x == s[0]:
    a -= 1
else:
    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()

c = {}
c[S] = A
c[T] = B
c[U] -= 1
print("{} {}".format(c[S],c[T]))

Submission status: Accepted

Solution code:
S, T = input().split()
A, B = input().split()
U = input()
num = {}
num[S] = int(A)
num[T] = int(B)
num[U] = num[U] - 1
print(str(num[S])+" "+str(num[T]))

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(a,b)

Submission status: Accepted

Solution code:
input = [input().split(" ") for i in range(3)]
c = {}
c[input[0][0]] = int(input[1][0]) 
c[input[0][1]] = int(input[1][1])
c[input[2][0]] -= 1
print(c[input[0][0]], c[input[0][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()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
list1 = input()
list2 = input()
list3 = input()
nlist1 = list1.split(' ')
nlist2 = list2.split(' ')
S = nlist1[0]
T = nlist1[1]
lenS = int(nlist2[0])
lenT = int(nlist2[1])
select = list3
if select == S:
    lenS -= 1
elif select == T:
    lenT -= 1
print(lenS,lenT)

Submission status: Accepted

Solution code:
#from math import sqrt
#from heapq import heappush, heappop
#from collections import deque
#s, t = [int(v) for v in int(input())]

s, t = input().split()
a, b = [int(v) for v in input().split()]
u = input()

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

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

Submission status: Accepted

Solution code:
sa, sb  = input().split()
a,  b   = map(int, input().split())
sc      = input().strip()
if sc == sa:
    print(a-1, b, sep = ' ')
else:
    print(a, b-1, sep = ' ')

Submission status: Accepted

Solution code:
s1,s2 = (input().split(" "))
a1,a2 = list(map(int,input().split(" ")))
U =input()
if U == s1:
    a1 -= 1
else:
    a2-=1
print(a1,a2)

Submission status: Accepted

Solution code:
def getline():
    input_line = input()
    input_list = input_line.split()
    return input_list

temp = getline()
S = temp[0]
T = temp[1]

temp = getline()
A = int(temp[0])
B = int(temp[1])

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

Submission status: Accepted

Solution code:
input1 = list(map(str,input().split()))
input2 = list(map(int,input().split()))
input3 = input()

if input1.index(input3) == 0:
    print(input2[0] - 1, input2[1])
    
elif input1.index(input3) == 1:
    print(input2[0], input2[1] - 1)
    
else:
    print(input2[0],input2[1])

Submission status: Accepted

Solution code:
input1 = input()
input2 = input()
input3 = input()

input1a = input1.split(" ")
input2a = input2.split(" ")

s = input1a[0]
t = input1a[1]
a = input2a[0]
b = input2a[1]

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

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

Submission status: Accepted

Solution code:
line1 = input()
line2 = input()
line3 = input()

str_s, str_t = line1.split(" ")
num_a, num_b = line2.split(" ")

if line3 == str_s:
    print(str(int(num_a)-1), num_b)
else:
    print(num_a,str(int(num_b)-1))

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
a,b=input().split()
d={}
d[a]=0
d[b]=0
d[a],d[b]=map(int,input().split())
x=input()
d[x]-=1
print(d[a],d[b])

Submission status: Accepted

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

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

Submission status: Accepted

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

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

balls = {}

balls[s] = a
balls[t] = b

balls[u] = balls[u] - 1

print('{0} {1}'.format(balls[s], balls[t]))

Submission status: Accepted

Solution code:
b1,b2=map(str,input().split())
c1,c2=map(int,input().split())
x=input()
if x==b1:
	print(c1-1,c2)
elif x==b2:
	print(c1,c2-1)
else:
	print(c1,c2)

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:
l=input().split() 
n = list(map(int, input().split()))
t=input()
if l[0]==t:
    n[0]=n[0]-1
    print(n[0],n[1])
elif l[1]==t:
    n[1]=n[1]-1
    print(n[0],n[1])

Submission status: Accepted

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

Submission status: Accepted

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

if a == c:
    print(A - 1, B)
else:
    print(A, B - 1)

Submission status: Accepted

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

if(S==U):
	A=A-1
elif(T==U):
	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()
    res = {
        s:a,
        t:b
    }
    res[U] -=1
    print("{0} {1}".format(res[s], res[t]))


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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(a,b)

Submission status: Accepted

Solution code:
moji_arr = input()

first = moji_arr.split()[0]
second = moji_arr.split()[1]

num = input()
num_arr = list(map(int, num.split()))

u = input()

if u==first:
    num_arr[0] = num_arr[0] - 1
elif u==second:
    num_arr[1] = num_arr[1] - 1

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

Submission status: Accepted

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

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

print(A, B)

Submission status: Accepted

Solution code:
colors = list(map(str, input().split()))
numbers = list(map(int, input().split()))
target_color = input() 

for index, color in enumerate(colors):
  if color == target_color:
    numbers[index] = numbers[index] - 1
    
 
for num in numbers:
  print(str(num) + " ", end="")

Submission status: Accepted

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

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

st=input()

if st == s:
  ss-=1
else:
  tt-=1
print(ss,tt)

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:
name = input().split()
n1 = name[0]; n2 = name[1]
lnum = input().split()
lnum1 = int(lnum[0]); lnum2 = int(lnum[1])
l1 = [n1, lnum1]
l2 = [n2, lnum2]
choosen = input()
if choosen == n1:
    print(l1[1]-1, end=" ")
    print(l2[1])
if choosen == n2:
    print(l1[1], end=" ")
    print(l2[1]-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:
# -*- coding: utf-8 -*-

def abc154a(s, t, a, b, u):
    if(s == u):
        a -= 1
    else:
        b -= 1
    return(a, b)

###
# main
if(__name__ == '__main__'):
    # input
    (s, t) = input().split()
    (a, b) = map(int, input().split())
    u = input()
    
    (new_a, new_b) = abc154a(s, t, a, b, u)
    
    # output
    print(str(new_a) + " " + str(new_b))
# else:
    # do nothing

Submission status: Accepted

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

Submission status: Accepted

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

def abc154a(s, t, a, b, u):
    if(s == u):
        a -= 1
    else:
        b -= 1
    return(a, b)

###
# main

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

(new_a, new_b) = abc154a(s, t, a, b, u)

# output
print(str(new_a) + " " + str(new_b))

Submission status: Accepted

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

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

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

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 = 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:
input_S_T = list(input().split())
input_count = list(map(int,input().split()))
input_trash = input()

total_list = []

for i in range(input_count[0]):
    total_list.append(input_S_T[0])

for i in range(input_count[1]):
    total_list.append(input_S_T[1])

total_list.remove(input_trash)

print(total_list.count(input_S_T[0]),total_list.count(input_S_T[1]),end=' ')

Submission status: Accepted

Solution code:
#ABC154A
import sys
from collections import OrderedDict
d = OrderedDict()
s,t = sys.stdin.readline().split()
n1, n2 = map(int, sys.stdin.readline().split())
d[s] = n1
d[t] = n2

d[sys.stdin.readline().rstrip()] -=1

print(*d.values())

Submission status: Accepted

Solution code:
input_S_T = list(input().split())
input_count = list(map(int,input().split()))
input_trash = input()

total_list = []

for i in range(input_count[0]):
    total_list.append(input_S_T[0])

for i in range(input_count[1]):
    total_list.append(input_S_T[1])

total_list.remove(input_trash)

print(total_list.count(input_S_T[0]),total_list.count(input_S_T[1]),end=' ')

Submission status: Accepted

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

if A[0] == U:
    print(str(B[0]-1) + " " + str(B[1]))

if A[1] == U:
    print(str(B[0]) + " " + str(B[1]-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('{} {}'.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
if u==t:
    b-=1
print(a,b)

Submission status: Accepted

Solution code:
def main():
    colors = list(map(str, input().split(" ")))
    nums = list(map(int, input().split(" ")))
    trash = input()
    
    nums[colors.index(trash)] -= 1
    print(' '.join(map(str, nums)))

main()

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
s = list(map(str, input().split()))
num = list(map(int, input().split()))
ALL = {}
for i in range(len(s)):
  ALL[s[i]] = num[i]
 
ALL[input()] -= 1
 
for i in range(len(s)):
  print(ALL[s[i]], end = ' ')

Submission status: Accepted

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

if moji[0] == moji_w:
  kazu[0] = kazu[0] - 1
else:
  kazu[1] = kazu[1] - 1
print("{} {}".format(kazu[0], kazu[1]))

Submission status: Accepted

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

if U==moji[0]:
  kazu[0]=kazu[0]-1
else:
  kazu[1]=kazu[1]-1
  
print(kazu[0],kazu[1])

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
text_st = input()
text_ab = input()
u = input()

def get(text,n):
    ans = [""]*n
    i = 0
    for x in text:
        if x==" ":
            i = i + 1
        ans[i] = ans[i]+x
    return ans

s = get(text_st,2)[0]
t = get(text_st,2)[1]
a = int(get(text_ab,2)[0])
b = int(get(text_ab,2)[1])

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 13 19:20:01 2020

@author: dantitussalajan
"""
'''
# get a integer
a = int(input())
# get two integers separated with half-width break
b, c = map(int, input().split())
# get a string
s = input()
# output
print(str(a+b+c) + " " + s)
'''

#first line
S,T=map(str,input().split())
#second line
A,B=map(int,input().split())
#third line
U=input()

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

Submission status: Accepted

Solution code:
s1, s2 = input().split()
a1, a2 = [int(i) for i in input().split()]
s = input()

if s1 == s:
  print(a1 - 1, a2)
elif s2 == s:
  print(a1, a2 - 1)
else:
  print(a1, a2)

Submission status: Accepted

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

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

print(BallA, BallB)

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

Submission status: Accepted

Solution code:
S, T = input().split()
a, b = map(int,input().split())
U = input()
if S == U:
    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(str(a) + " " + str(b))