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 = list(map(str,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:
if __name__ == "__main__":
    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:
from sys import stdin
import sys
import numpy as np
import collections
from functools import cmp_to_key
import heapq

##  input functions for me
def rsa(sep = ''):
    if sep == '' :
        return input().split() 
    else: return input().split(sep)
def rip(sep = ''):
    if sep == '' :
        return map(int, input().split()) 
    else: return map(int, input().split(sep))
def ria(sep = ''): 
    return list(rip(sep))
def ri(): return int(input())
def rd(): return float(input())
def rs(): return input()
##
def main():
    s, t = rsa()
    a, b = ria()
    u = rs()
    if s == u: a -= 1
    if t == u: b -= 1
    print("{0} {1}".format(a,b))


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S, T = 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 S==U:
    A-=1
elif T==U:
    B-=1
else:
    pass

print("{:0} {:1}".format(A,B))

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

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

Submission status: Accepted

Solution code:
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])
 
def main():
    s,t = inpls()
    a,b = inpm()
    u = str(input())
    if s==u:
        print(a-1)
        print(b)
    else:
        print(a)
        print(b-1)
    
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#coding:utf-8
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 = map(str, input().split())
A, B = map(int, input().split())
U = input()
if S == U:
  A -= 1
elif T == U:
  B -= 1
print('{0} {1}'.format(A, B))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a=input().split()
b=list(map(int,input().split()))
c=input()
if c==a[0]:
  b[0]-=1
if c==a[1]:
  b[1]-=1
print(str(b[0])+' '+str(b[1]))

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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
    U = '0'

if T == U:
    B -= 1

print(A, B)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
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 = 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, list(input().split()))
U = input()

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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:
from heapq import heappush,heappop
import queue
import re
import math
import functools


def i_raw():
    return int(input())

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

def is_raw():
    return list(map(int, ss_raw()))

INF = 1<<29

def make1d_arr(n,val=INF):
    return [val for i in range(n)]

def make2d_arr(h,w,val =INF):
    return [[val for i in range(w)]for i in range(h)]

def gcd (a,b):
    if(b==0):
        return a
    return gcd(b,a%b)


def main():
    S,T = ss_raw()
    A,B = is_raw()
    U = input().strip()
    if U==S:
        return " ".join(map(str,[A-1,B]))
    else:
        return " ".join(map(str,[A,B-1]))  


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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.buffer.read
#input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines

# mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
# import numpy as np

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)
	
	
	
	
	
	
if __name__ == "__main__":
	main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
input1 = input()
s = str(input1).split(' ')[0]
t = str(input1).split(' ')[1]
input2 = input()
a = int(str(input2).split(' ')[0])
b = int(str(input2).split(' ')[1])
u = str(input())
if s == u:
  a = a - 1
else:
  b = 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):
        A -= 1
    else:
        B -=1

    print("{} {}".format(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:
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:
red,blue=input().split()
a,b=list(map(int,input().split()))
s = input()
if s == red:
    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
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 S == U:
    A = A - 1
else:
    B = B - 1
print('{} {}'.format(A, B))

Submission status: Accepted

Solution code:
s, t = input().split()
a, b = map(int, input().split())
d = {s: a, t: b}
d[input()] -= 1
print("{} {}".format(d[s], d[t]))

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

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

Submission status: Accepted

Solution code:
a = input()
a = a.split()
b = input()
b = b.split()
c = input()
dic = {a[0]:int(b[0]),a[1]:int(b[1])}
dic[c] = dic[c]-1
print(str(dic[a[0]])+" " +str(dic[a[1]]))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S, T = input().split()
A, B = [int(v) for v 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:
  A = A-1
else:
  B = B-1

print(' '.join(map(str, [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 = list(map(str, input().split()))
A, B = list(map(int, input().split()))
U = input()

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

print(A,B)

Submission status: Accepted

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

Submission status: Accepted

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

import sys
import os

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

def main():
    s, t = sys.stdin.readline().split()
    a, b = [int(x) for x in sys.stdin.readline().split()]
    u = sys.stdin.readline().strip()

    a_, b_ = solve(s, t, a, b, u)

    print(a_, b_)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S,T=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:
a,b=map(str,input().split())
a_num,b_num=map(int,input().split())
delete_one=input()

if a==delete_one:
    a_num-=1
else:
    b_num-=1
print(a_num,b_num)

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

Submission status: Accepted

Solution code:
st=input().split()
s=st[0]
t=st[1]
ab=input().split()
a=int(ab[0])
b=int(ab[1])
u=input()
if(u==s):
    a=a-1
if(u==t):
    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:
    print(str(a-1)+" "+str(b))
else:
    print(str(a)+" "+str(b-1))

Submission status: Accepted

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

S = a[0]
T = a[1]

b = list(map(int, input().split()))
A = b[0]
B = b[1]

c = input()

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

print("%d %d" % (b[0], b[1]))

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-
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)
elif T == u:
    print(A, B-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
    print(a , b)
if t == u:
    b -= 1
    print(a , b)

Submission status: Accepted

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

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

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

print(a,b)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=input().split()
c,d=map(int,input().split())
if input()==a:
    print(c-1,d)
else:
    print(c,d-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:
'''
red blue
3 4
red
'''
a, b = [x for x in input().split()]
an, bn = [int(x) for x in input().split()]
threw = input()
if threw == a:an -= 1
else:
    bn -= 1
print(an, bn)

Submission status: Accepted

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

Submission status: Accepted

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

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

else:
	print(a, b-1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys

# import itertools
# import math
# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

S, T = readline().decode('utf8').split()
A, B = map(int, readline().split())
U = readline().decode('utf8').strip()
if S == U:
    A -= 1
if T == U:
    B -= 1

print(A, B)

Submission status: Accepted

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

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)
if b == e:
  print(c,d-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:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

S,T = list(map(str, sys.stdin.readline().split()))
A,B = LI()
U = str(input())

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

Submission status: Accepted

Solution code:
import sys

def main():

    # sys.stdin = open("input154a.txt")

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(A, B, sep = " ")

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(12345678)
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop


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

    print(a, b)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

A,B = int(A),int(B)

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

print(str(a1) + " " + str(b1 - 1) if input() == b else str(a1 - 1) + " " + str(b1))

Submission status: Accepted

Solution code:
s,t = input().split()
N,M = list(map(lambda x:int(x),input().split()))
#print(s,t,N,M)
u=input()

print(N-(s==u),M-(t==u))

Submission status: Accepted

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

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

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

print(a,b)

Submission status: Accepted

Solution code:
s,a,u=open(0)
*a,=map(int,a.split())
a[u in s]-=1
print(*a)

Submission status: Accepted

Solution code:

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

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

print(a, b)

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
S,T = input().rstrip().split(' ')
A,B = [int(i) for i in input().rstrip().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 = str(input())

if U == S:
  A = A-1
elif U == T:
  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 == t:
  b = b -1
else:
  a = a -1
  
print(a,b)

Submission status: Accepted

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

Submission status: Accepted

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

dict = {S: a, T: b}
U = input()
dict[U] -= 1

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

Submission status: Accepted

Solution code:
S, T = input().split()
N = {s : int(n) for s, n in zip((S, T), input().split())}
N[input()] -= 1
print(N[S], N[T])

Submission status: Accepted

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

a,b = [int(i) for i in input().split()]

ball = input()


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

Submission status: Accepted

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

Submission status: Accepted

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

if a == i:
    print(x-1, y)
else:
    print(x, y-1)

Submission status: Accepted

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


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

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

Submission status: Accepted

Solution code:
line = input()
line = line.split(" ")
S = line[0]
T = line[1]
line = input()
line = line.split(" ")
A = int(line[0])
B = int(line[1])
U = input()
if U == S:
	A-=1
else:
	B-=1
print("{} {}".format(A,B))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math
import itertools
import fractions
import heapq
import collections
import bisect
import sys
import copy

sys.setrecursionlimit(10**9)
mod = 998244353
inf = 10**20

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

s,t = LS()
a,b = LI()
u = S()

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

Submission status: Accepted

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

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

Submission status: Accepted

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


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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# A - Remaining Balls
def main():
    S, T = input().split()
    A, B = map(int, input().split())
    U = input().rstrip()
    if U == S:
        A -= 1
    else:
        B -= 1
    print(A, B)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
st = list(map(str,input().split()))
ab = list(map(int,input().split()))
u = str(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=str(input())
if u==s:
	a-=1
else:
	b-=1
print("{} {}".format(a,b))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(A,B)

Submission status: Accepted

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

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

Submission status: Accepted

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