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:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

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


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(S, T, A, B, U):
    if S == U:
        A -= 1
    else:
        B -= 1
    return '%d %d' % (A, B)


def main():
    S, T = read_str_n()
    A, B = read_int_n()
    U = read_str()
    print(slv(S, T, A, B, U))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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:
    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("{} {}".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())
U = input()
ans = ""
if U==S:
    A=A-1
    a=str(A)
    b=str(B)
    ans = a+" "+b
    print(ans)
else:
    B-=1
    a=str(A)
    b=str(B)
    ans=a+" "+b
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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:
s1, s2 = (i for i in input().split())
a, b = (int(i) for i in input().split())
u = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

def main():
    from sys import stdin, setrecursionlimit
    #from sys import stdin, setrecursionlimit
    #setrecursionlimit(10**9)
    #n = int(stdin.readline()[:-1])   
    #r = stdin.readline()[:-1]
    #r = [stdin.readline() for i in range(n)]
    #t = [int(stdin.readline()) for i in range(n)]
    #n = int(r)
    #a = r.split()
    #a,b,c = r.split()
    #a = list(map(int, r.split()))
    #a,b,c,d = map(int, r.split())
    #a = list(map(int, r.split()))
    #a = [int(s[i]) for i in range(1, n+1)]
    #a = [list(map(int, r.split())) for i in range(1,n+1)]
    #a = [list(map(int, input().split())) for i in range(1,n+1)]
    #res = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[] for _ in range(num)]
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

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

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

Submission status: Accepted

Solution code:
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(A, B)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.readline
S, T = readline().strip().split()
A, B = map(int, readline().split())
if readline().strip() == 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(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)
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 == T:
    print(A,B-1)
elif U == S:
    print(A-1,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:
    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 s == u:
    A  -= 1
else:
    B -= 1
print(A, B)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#gcdは3.4.3だとfractionsにある
from fractions import gcd
import math

from math import factorial as f

from math import ceil,floor,sqrt


import bisect
import re
import heapq


from copy import deepcopy
import itertools

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))


def main():
    s,t = input().split()
    a,b = mi()
    u = input()

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

    print(a,b)



main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

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

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

print(A,B)

Submission status: Accepted

Solution code:
def main():
    # S = list(map(int, input().split()))
    S, T = input().split()
    a, b = map(int, input().split())
    U = input()
    if U == S:
        a -= 1
    else:
        b -= 1
    print(a, b)
    

main()

Submission status: Accepted

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

from collections import deque, defaultdict
import itertools as ite
import sys
import math
from decimal import *

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

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

Submission status: Accepted

Solution code:
def examA():
    S, T = LSI()
    A, B = LI()
    U = SI()
    if S==U:
        print(A-1,B)
    else:
        print(A,B-1)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math,random
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examA()

"""

"""

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
mod=10**9+7

s,t=input().split()
a,b=map(int,input().split())
u=input()
if s==u:
    a-=1
else:
    b-=1
lst=[a,b]
print(*lst)

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
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-=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:
S,T = (input().split())
a,b = (int(num) for num in input().split())
U = input()
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 s == u:
    print(a-1,b)
elif t == u:
    print(a,b-1)

Submission status: Accepted

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

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

Submission status: Accepted

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

ST = {S:0, T:1}
AB[ST[U]] -= 1

print(*AB)

Submission status: Accepted

Solution code:
#from fractions import gcd
#mod = 10 ** 9 + 7
#N = int(input())
#a = list(map(int,input().split()))
#a,b,c = map(int,input().split())
#ans = [0] * N
#math.ceilで切り上げ
import math
import string

def intinput():
    return int(input())

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

def splitintinput():
    return map(int,input().split())

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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


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

print(a, b)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(A, B)

Submission status: Accepted

Solution code:
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    S, T = input().rstrip().split()
    A, B = iim()
    U = input().rstrip()

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

if __name__ == "__main__":
    resolve()

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:
import sys
def input(): return sys.stdin.readline().rstrip()

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def S(): return input()


def MI(): return map(int, input().split())


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


YN = {False: 'No', True: 'Yes'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False
# show_flg = True


def main():
    S, T = MS()
    A, B = MI()
    U = input()

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

if __name__ == '__main__':
    print(main())

Submission status: Accepted

Solution code:
from sys import stdin
#n = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstrip().split()))
s,t = map(str, stdin.readline().rstrip().split())
#S = [list(map(int, stdin.readline().rstrip().split())) for _ in range(h)]
a,b = map(int, stdin.readline().rstrip().split())
u = str(stdin.readline().rstrip())

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

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc154/tasks/abc154_a
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()
sx,tx=map(int,input().split())
a=input()
if a==s:
    sx-=1
else:
    tx-=1
print(sx,tx)

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:
import sys
input = sys.stdin.readline

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
import re
import math
import itertools
from copy import deepcopy
import fractions
import random
from heapq import heappop,heappush
import time
import sys
readline = sys.stdin.readline
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def fac_list(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
#main
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:
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) 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 II(): return int(sys.stdin.readline())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res

S,T=input().split()
i,j=LI()
term = input()
if term == S:
    i -= 1
if term == T:
    j -= 1

print(i,j)