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: Runtime Error

Solution code:
n=int(input())
l=list(map(int, input().split()))
tester=True
for i in range(n):
    for j in range(i+1,n):  
        if l[i]==l[j]:
            tester=False
            break

if tester==True:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
lis = list(map(int,input().split()))
new_lis = [(l+1)/2 for l in lis]
ans = 0
for i in range(n-k+1):
    if sum(new_lis[i:i+k]) > ans:
        #print(new_lis[i:i+k])
        ans = sum(new_lis[i:i+k])
print(ans)

Submission status: Runtime Error

Solution code:
n=int(input())
l=list(map(int,input().split()))
ll=list(set(l))
n=len(l)
nn=len(ll)
if n==nn:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N=input()
A=input().split()
if(A in N):
  print("YES")
else:
  print("NO")

Submission status: Runtime Error

Solution code:
ball_name1,ball_name2 = input().split(" ")
ball1,ball2 = input().split(" ")
ball1 = int(ball1)
ball2 = int(ball2)
ball_chosen = input()


if (ball_chosen in ball_name1) :
    print(f'{ball1-1} {ball2}')
else:
    print(f'{ball1} {ball2-1}')

Submission status: Runtime Error

Solution code:


a, b, c = [0] * 3
x = []

def format_input(filename = None):
	global a, b, c
	global x
	if filename == None:
		a, b, c = list(map(int, input().split()))
		x = [list(map(int, input().split())) for i in range(n)]

	elif filename == '__random__'
		from random import randint as rng
		a = rng(1, 10**1)
		b = rng(1, 10**1)
		c = rng(1, 10**1)
		x = [[rng(1, 10**1), rng(1, 10**1)] for i in range(n)]

def get_answer(a, b, c, x):
	answer = 0
	return answer

if __name__ == '__main__':
	format_input('__random__')

	ans = get_answer(a, b, c, x)
	print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
a = input().split()
b = set(a)
if len(b)<len(a):
    print("NO")
else:
    print("YES")

Submission status: Runtime Error

Solution code:
A, B= input().split()
num = [int(x) for x in input().split()]
C = input()

if C == A:
  num[0]=num[0]-1
else:
  num[1]= num[1]-1
  
print(num[0]+" "+num[1])

Submission status: Runtime Error

Solution code:
inputs = list(map(str,input().split()))

a = int(inputs[2])
b= int(inputs[3])

if inputs[4] == inputs[0]:
  a = a - 1
elif inputs[4] == inputs[1]:
  b = b - 1

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

Submission status: Runtime Error

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

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

print(a, b)

Submission status: Runtime Error

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


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

print A, B

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
s = input().split()
n = input().split()
s2 = input()
 
if s[0] == s2:
  n[0] = n[0] - 1
else:
  n[1] = n[1] - 1
 
print(str(n[0]) +' '+str(n[1]))

Submission status: Runtime Error

Solution code:
import sys

def main():
    k = input().replace('\n','').split()
    a = input().replace('\n','').split()
    u = input().replace('\n','')
    a[k.index(u)]=int(a[k.index(u)]) - 1
    print(str(a[0]) + ' ' + a[1])
if __name__ == '__main__':
    input = sys.stdin.readline
    main()

Submission status: Runtime Error

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: Runtime Error

Solution code:
X = input().split()
S = X[0]
T = X[1]
Y = input().split()
A = int(Y[0])
B = int(Y[1])
U = input()
 
A -= 1 if U == S else B -= 1
 
print(str(A) + " " + str(B))

Submission status: Runtime Error

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

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

print(a, b)

Submission status: Runtime Error

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

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

print(f"{A} {B}")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def solve():
    S, T, A, B, U = map(int, open(0).read().split())
    if S == U:
        print(A - 1, B)
    else:
        print(A, B - 1)


if __name__ == '__main__':
    solve()

Submission status: Runtime Error

Solution code:
a = input().split()
if a[4] is a[0]:
    b =int(a[2])-1
else:
    c =int(a[3])-1
print(b,c)

Submission status: Runtime Error

Solution code:
N=int(input())
A=input()
if len(set(A))-1==N:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S, T = input().split()
s_i, t_i = map(int, input().split())
U = input()

if U == S:
    print(str(s_i - 1) + " " + str(t_i))
else
    print(str(s_i) + " " + str(t_i - 1))

Submission status: Runtime Error

Solution code:
import numpy as np

color = input().split(" ")
count = np.array(input().split(" "), dtype="int64")
choose = input()

a = color.index(choose)
count[a] -= 1
print(f"{count[0]} {count[1]}")

Submission status: Runtime Error

Solution code:
X = input().split()
S = X[0]
T = X[1]
Y = input().split()
A = int(Y[0])
B = int(Y[1])
U = input()

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

print(A + " " + B)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

print(a)
print(b)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def a():
    s, t  = input().split()
    print(s)
    print(t)
    s_n, t_n = input().split()
    u = input()
    print(u)
    if u == s:
        s_n = int(s_n) - 1
    elif t == u:
        t_n = int(t_n) - 1
    return f"{s_n} {t_n}"
a()

Submission status: Runtime Error

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

if S == 'blue' or S=='red':
	print(A-1)
else:
	print(B-1)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#!python3.4
# -*- coding: utf-8 -*-
# abc154/abc154_a
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    S,T = i2s().split()
    A,B = i2nn()
    U = i2s()
    d = {S:A, T:B}
    d[U] -= 1
    print(d[A], d[B])
    return

main()

Submission status: Runtime Error

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

if S==U:
    a-=1
else:
    b-=1

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if S == 'blue' or S=='red':
	print(A-1)
else:
  print(B-1)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

import sys
import math


debug = False

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

def parse_input(lines_as_string = None):

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

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

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


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

    return result
    


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

if __name__ == '__main__':

    main()

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
int main()  {
  string s;
  string t;
  cin >> s >> t;
  int a, b;
  cin >> a >> b;
  string u;
  cin >> u;
  if (u == s) {
    a -= 1;
  }
  else {
    b -= 1;
  }
  cout << a << " " << b << endl;
}

Submission status: Runtime Error

Solution code:
red = int(input())
blue = int(input())
ans = input()
if ans=="blue":
  blue--
else:
  red--
print(red)
print(blue)

Submission status: Runtime Error

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

INF = float('inf')

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


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


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

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

Submission status: Runtime Error

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: Runtime Error

Solution code:
#Stringの場合
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: Runtime Error

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

if(u in s[0]):
    print(str(a - 1) + ' ' + str(b))
elif(u in s[1]):
    print(str(a) + ' ' + str(b - 1))
else:
    print(str(a) + ' ' + str(b))

Submission status: Runtime Error

Solution code:
#include<stdio.h>
#include<string.h>
int main(void){
	char ball1[100];
	char ball2[100];
	scanf("%s %s",ball1,ball2);
	int num1,num2;
	scanf("%d %d",&num1,&num2);
	char target[100];
	scanf("%s",target);
	if(strcmp(target,ball1)==0){
		num1--;
	}else{
		num2--;
	}
	printf("%d %d\n",num1,num2);
	return 0;
}

Submission status: Runtime Error

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

Submission status: Runtime Error

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: Runtime Error

Solution code:
red = int(input())
blue = int(input())
ans = input()
if ans=="blue":
  blue--
else:
  red--

Submission status: Runtime Error

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: Runtime Error

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

Submission status: Runtime Error

Solution code:
n,m = input().split()
r,b = map(int,input().split())
i = input()
if i == n:
  r = r -1
  print(r + ' ' + b)
else:
  b = b-1
  print(r + ' ' + b)

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int,input().split()))
if(len(a) == len(set(a))):
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:

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

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

print(f'{A} {B}')

Submission status: Runtime Error

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


def solve(S: str, T: str, A: int, B: int, U: str):
    dictionary = {S: A, T: B}
    dictionary[U] = dictionary[U] - 1
    print(f"{dictionary[S]} {dictionary[T]}")
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    T = next(tokens)  # type: str
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    U = next(tokens)  # type: str
    solve(S, T, A, B, U)


if __name__ == "__main__":
    main()

Submission status: Runtime Error

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

#処理
if S==U:
    A-=1
elif T==U:
    B-=1
    
print(str(A)+" "+str(B))

Submission status: Runtime Error

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(f"{A} {B}")

Submission status: Runtime Error

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: Runtime Error

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

Submission status: Runtime Error

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

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

print(A, B)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

print(f'{a} {b}')

Submission status: Runtime Error

Solution code:
s = input().split()
n = input().split()
s2 = input()

if s[0] == s2:
  n[0] = n[0] - 1
else:
  n[1] = n[1] - 1

print(str(n[0]) +' '+str(n[1]))

Submission status: Runtime Error

Solution code:
s, t = map(str, 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: Runtime Error

Solution code:
def I(): return int(input())
def MI(): return map(int, input().split())
def LMI(): return list(map(int, input().split()))


S, T = input().split()
A, B = MI()
U = input()
if U == S:
    S -= 1
elif U == T:
    B -= 1
print(A, B)

Submission status: Runtime Error

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: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

print(f'{A} {B}')

Submission status: Runtime Error

Solution code:
import sys


TEST_INPUT = [
    """
    red blue
    3 4
    red
    """,
    """
    red blue
    5 5
    blue
    """
]
ANSWER = [
    "2 4",
    "5 4"
]


class InputHandler:

    def __init__(self, text_lines="", is_test=False):
        self.data = list(text_lines.split("\n"))
        self.index = 0
        self.is_test = is_test

    def input(self):
        if self.is_test:
            self.index += 1
            return self.data[self.index].strip()
        else:
            return sys.stdin.readline().rstrip()


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


def main():
    ih = InputHandler()
    s, t = ih.input().split()
    a, b = map(int, ih.input().split())
    u = ih.input()
    res = solve(s, t, a, b, u)
    print(res)


def test():
    for test_input, ans in zip(TEST_INPUT, ANSWER):
        ih = InputHandler(test_input, True)
        s, t = ih.input().split()
        a, b = map(int, ih.input().split())
        u = ih.input()
        res = solve(s, t, a, b, u)
        assert str(res) == str(ans)


if __name__ == "__main__":
    test()
    main()

Submission status: Runtime Error

Solution code:
color = input().split()
num = input().split()
choice = input()
for i in 2:
  if choice == color[i]:
    num[i] = int(num[i]) - int(color[i])
    
print(num)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
red blue
3 4
red

Submission status: Runtime Error

Solution code:

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

Submission status: Runtime Error

Solution code:
str1, str2 = input().split()
cnt1, cnt2 = list(map(int, input().split()))
tar = input()

if tar == str1:
  cnt1 -= 1
else
  cnt2 -= 1

print(str(cnt1) + " " + str(cnt2))

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;
const int MOD = 1000000007; // 計算してからmodで割る ans = (ans * a) % mod
#define int long long
template <typename T = long long > T in () { T x; cin >> x; return(x);}
// int a = in() のように使うlong long以外の型の時はstirng s = in<string>()のように型を指定する

signed main(void){
    string a, b; cin >> a >> b;
    int n, m; cin >> n >> m;
    string c; cin >> c;
    if(a == c) n--;
    else m--;
    cout << n << " " << m << endl;
}

Submission status: Runtime Error

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: Runtime Error

Solution code:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		if(S == U) score[0]--;
		else score[1]--;
		Console.WriteLine(String.Join(" ",score));
	}
	String S,T;
	int[] score;
	String U;
	public Sol(){
		var ss = rsa();
		S = ss[0]; T = ss[1];
		score = ria();
		U = rs();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}