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=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:
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
from fractions import gcd
# 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)])

s,t = input().split()
a,b = inpm()
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()

    print(A - (U == S), B - (U == T))


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 = input().split()
A,B = input().split()
A = int(A)
B = int(B)
U = input()
if U == S :
    A = A - 1
    print(A,B)
elif 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(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:
dict = {}
S, T = input().split(' ')
dict[S], dict[T] = map(int, input().split(' '))
U = input()
dict[U] -= 1
print(dict[S], dict[T])

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def remaining_balls():
    # 入力
    S, T = input().split()
    A, B = map(int, input().split())
    U    = input()
    # 処理
    if S == U:
        print(A-1, B)
    else:
        print(A, B-1)

remaining_balls()

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

Submission status: Accepted

Solution code:
str = input().split(" ")
S = str[0]
T = str[1]
num = input().split(" ")
NS = int(num[0])
NT = int(num[1])
U = input()

if S == U:
  print(NS - 1, end=" ")
  print(NT)
else:
  print(NS, end=" ")
  print(NT - 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
    print(a,b)

else:
    b -= 1
    print(a,b)

Submission status: Accepted

Solution code:
l1,l2=map(str,input().split(' '))
r,b=map(int,input().split(' '))
find=input()

if find==l1:
    r-=1
else:
    b-=1
print(r,b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))

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

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

print(a,b)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:


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


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    S, T = input().split(' ')
    A, B = read_ints()
    U = input()
    if U == S:
        A -= 1
    else:
        B -= 1
    print(A, B)


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
# abc154_a.py
# https://atcoder.jp/contests/abc154/tasks/abc154_a

# A - Remaining Balls /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 100点

# 問題文
# 文字列 Sの書かれたボールが A 個、文字列 T の書かれたボールが B 個あります。
# 高橋君は、文字列 U の書かれたボールを 1 個選んで捨てました。
# 文字列 S,Tの書かれたボールがそれぞれ何個残っているか求めてください。

# 制約
#     S,T,Uは英小文字のみからなる文字列
#     S,Tの長さは 1 以上 10以下
#     S≠T
#     S=Uまたは T=U
#     1≤A,B≤10
#     A,Bは整数

# 入力
# 入力は以下の形式で標準入力から与えられる。
# S T
# A B
# U

# 出力
# 答えを空白区切りで出力せよ。

# 入力例 1
# red blue
# 3 4
# red

# 出力例 1
# 2 4

# 高橋君は red が書かれたボールを 1つ選んで捨てました。
# 文字列 S,T が書かれたボールは、それぞれ 2,4個残っています。

# 入力例 2
# red blue
# 5 5
# blue

# 出力例 2
# 5 4

# 高橋君は blue が書かれたボールを 1つ選んで捨てました。
# 文字列 S,T が書かれたボールは、それぞれ 5,4 個残っています。


global FLAG_LOG
FLAG_LOG = False


def log(value):
    # FLAG_LOG = True
    # FLAG_LOG = False
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    S, T = lines[0].split()
    A, B = list(map(int, lines[1].split()))
    U = lines[2]
    # values = list(map(int, lines[1].split()))
    # values = list(map(int, lines[2].split()))
    # values = list()
    # for i in range(N):
    #     values.append(int(lines[i]))
    # valueses = list()
    # for i in range(N):
    #     valueses.append(list(map(int, lines[i+1].split())))

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

    result = str(A) + ' ' + str(B)

    return [result]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['red blue', '3 4', 'red']
        lines_export = ['2 4']
    if pattern == 2:
        lines_input = ['red blue', '5 5', 'blue']
        lines_export = ['5 4']
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(3)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
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)
else:
    print(a, b-1)

Submission status: Accepted

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

if x == 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)

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

mydict = {S:A, T:B}

mydict[U] -= 1
print ( str( mydict[S] ) + " " +str( mydict[T] )  )

Submission status: Accepted

Solution code:
st = list(input().split())
ab = list(map(int, input().split()))
d = dict(zip(st, ab))
u = input()
d[u] -= 1
print(*list(d.values()))

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==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:
L = input().split()
a,b = map(int, input().split())
if input()==L[0]:
  a -= 1
else:
  b -= 1
print(str(a) + ' ' + str(b))

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
def solve():
  S, T = input().split()
  ans = list(map(int, input().split()))
  U = input()
  if U==S:
    ans[0] -= 1
  else:
    ans[1] -= 1
  return ans
print(*solve())

Submission status: Accepted

Solution code:
# Problem A - Remaining Balls

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

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

# output
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)
    exit()
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}
if U == s:
    print(a - 1, b)
else:
    print(a, b - 1)

Submission status: Accepted

Solution code:
# 2020/07/23
# AtCoder Beginner Contest 154 - A

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

aa = a
ab = b

# Calc
if s == u:
    aa = aa - 1
elif t == u:
    ab = ab - 1

# Output
print(aa, ab)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

ss, st = ins().split()
a, b = inm()
su = ins()


def solve():
    if su == ss:
        return (a - 1), b
    else:
        return a, (b - 1)


print(*solve())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
dic = defaultdict(int)
s,t = input().split()
a,b = readInts()
dic[s] = a
dic[t] = b
u = input()
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: 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()
print(A-1 if S==U else A)
print(B if S==U else B-1)

Submission status: Accepted

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

if not ( S.islower() and T.islower() and U.islower() ): sys.exit()
if not ( 1 <= len(S) <= 10 and 1 <= len(T) <= 10 ): sys.exit()
if not ( S != T ): sys.exit()
if not ( S == U or T == U ): sys.exit()
if not ( isinstance(A,int) and isinstance(B,int) ): sys.exit()

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

Submission status: Accepted

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


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


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

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


main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#Macで実行する時
import sys
import os
if sys.platform=="darwin":
	base = os.path.dirname(os.path.abspath(__file__))
	name = os.path.normpath(os.path.join(base, '../atcoder/input.txt'))
	sys.stdin = open(name)

l = list(map(str,input().split()))
a,b = map(int,input().split())
check = input()

if check == l[0]:
    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 s == u:
  a -= 1
else:
  b -= 1
print(a, b)

Submission status: Accepted

Solution code:
ST = input().split()
AB = list(map(int, input().split()))
U = input()
AB[ST.index(U)] -= 1
print(*AB)

Submission status: Accepted

Solution code:
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def s(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

p = L()
a,b = I()
u = s()
if u == p[0]:
    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:
    a=a-1
else:
    b=b-1
print(a,b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
sys.setrecursionlimit(10**7)

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

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

# b,r = map(str, readline().split())
# A,B = map(int, readline().split())
br = LS()
AB = LI()
U = _S()

def main():
    brAB = zip(br, AB)
    tmp=[]
    for c,n in brAB:
        if c==U:
            tmp.append(n - 1)
        else:
            tmp.append(n)
    return str(tmp[0])+' '+str(tmp[1])
print(main())

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

Submission status: Accepted

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

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

print(a,b)

Submission status: Accepted

Solution code:
S, T = "red", "blue"
A, B = 3, 4
U = "red"

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


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


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

print(a,b)

Submission status: Accepted

Solution code:
ST = input().split()
A, B = list(map(int, input().split()))
U = input()
idx = ST.index(U)
if idx == 0:
    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(str(a) + " " + str(b))

Submission status: Accepted

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

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

print(A, B)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
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 = a-1
elif u == t:
    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:
  print(str(A-1)+" "+str(B))
else:
  print(str(A)+" "+str(B-1))

Submission status: Accepted

Solution code:
S,T=map(str,input().split())
a,b=map(int,input().split())
U=input()
if U == S:
  a +=-1
elif U == T:
  b += -1
print(a,b)

Submission status: Accepted

Solution code:
st = input().split()
ab = map(int, input().split())
rb = input()

di = dict(zip(st, ab))
di[rb] -= 1
print(*list(di.values()))

Submission status: Accepted

Solution code:
S, T = input().split()
A, B = map(int, input().split())
d = dict(zip([S, T], [A, B]))
U = input()
d[U] -= 1
print(*d.values())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
color=input().split()
number = list(map(int, input().split()))
c = input()
for i in range(2):
  if c == color[i]: number[i] -= 1
number = list(map(str, number))
print(' '.join(number))

Submission status: Accepted

Solution code:
s, t = input().split()
d = {}
d[s] , d[t] = map(int, input().split())
d[input()]-=1
for i in d.values(): print(i, end = ' ')

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:
def main():
    str1, str2 = input().rstrip().split(' ')
    str1_quantity, str2_quantity = (int(i) for i in input().rstrip().split(' '))
    chosen_ball_str = input().rstrip()

    if str1 == chosen_ball_str:
        str1_quantity -= 1
    else:
        str2_quantity -= 1
    print('{} {}'.format(str1_quantity, str2_quantity))


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

bnum = {s: a, t: b}
bnum[u] -= 1
print('{} {}'.format(bnum[s], bnum[t]))

Submission status: Accepted

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

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)
elif T==U:
      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 :
    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:
    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:
r, b = input().split()

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

u = input()

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

Submission status: Accepted

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

print(f'{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 = list(input().split())
a, b = list(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(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(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 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
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(f'{A-1} {B}')
else:
    print(f'{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 == 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("{0} {1}".format(A-1,B))
else:
  print("{0} {1}".format(A,B-1))

Submission status: Accepted

Solution code:
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

def main():
    S,T = LS()
    A,B = LI()
    U = _S()
    print("{} {}".format(A-1,B) if U==S else "{} {}".format(A,B-1))

main()

Submission status: Accepted

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

#print(S,T,U)
#print(a,b)

if S == U:
    print(a-1,b)
elif T == U:
    print(a,b-1)
else:
    pass

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 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 u==s:
    print("{} {}".format(a-1,b))
elif u==t:
    print("{} {}".format(a,b-1))

Submission status: Accepted

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

if a == e:
  print("{} {}".format(c-1,d))
else:
  print("{} {}".format(c,d-1))

Submission status: Accepted

Solution code:
# Template 1.0
import sys, re
from decimal import *
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, floor, trunc, log
from heapq import heappush, heappop, heapify, nlargest, nsmallest
def STR(): return list(input())
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def list2d(a, b, c): return [[c] * b for i in range(a)]
def sortListWithIndex(listOfTuples, idx):   return (sorted(listOfTuples, key=lambda x: x[idx]))
def sortDictWithVal(passedDic):
    temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
    toret = {}
    for tup in temp:
        toret[tup[0]] = tup[1]
    return toret
def sortDictWithKey(passedDic):
    return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

a,b = map(str, input().split())

u,v = MAP()

z = input()

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

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

print(A, B)

Submission status: Accepted

Solution code:
(s, t), (n, m), q = input().split(), map(int, input().split()), input()
print(f'{n} {m - 1}' if q == t else f'{n - 1} {m}')

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
S, T = input().split()
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=list(input().split())
a,b=list(map(int,input().split()))
u=input()
ball={s:a,t:b}  
ball[u] =max(0,ball[u]-1)

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

Submission status: Accepted

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

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