AtCoder Beginner Contest 111 - AtCoder Beginner Contest 999

Cat Snuke is learning to write characters.
Today, he practiced writing digits 1 and 9, but he did it the other way around.
You are given a three-digit integer n written by Snuke.
Print the integer obtained by replacing each digit 1 with 9 and each digit 9 with 1 in n.

-----Constraints-----
 - 111 \leq n \leq 999
 - n is an integer consisting of digits 1 and 9.

-----Input-----
Input is given from Standard Input in the following format:
n

-----Output-----
Print the integer obtained by replacing each occurrence of 1 with 9 and each occurrence of 9 with 1 in n.

-----Sample Input-----
119

-----Sample Output-----
991

Replace the 9 in the ones place with 1, the 1 in the tens place with 9 and the 1 in the hundreds place with 9. The answer is 991.

Source: atcoder | Difficulty: EASY


Solutions:
print(''.join(({'1': '9', '9': '1'}[i] for i in input())))


a = int(input())
print(1110 - a)


print(999 + 111 - int(input()))


print(''.join(['9' if x == '1' else '1' for x in input()]))


print(input().replace('1', 'x').replace('9', '1').replace('x', '9'))


n = input()
ans = ''
for i in n:
	if i == '1':
		tmp = '9'
	elif i == '9':
		tmp = '1'
	else:
		tmp = i
	ans += tmp
print(ans)


print(input().replace('1', 'l').replace('9', '1').replace('l', '9'))


n = input()
n01 = n.replace('1', 'x')
n02 = n01.replace('9', 'y')
n03 = n02.replace('x', '9')
n04 = n03.replace('y', '1')
print(n04)


print(input().replace('1', '*').replace('9', '1').replace('*', '9'))


n = input()
ans = ''
for s in n:
	ans += '9' if s == '1' else '1'
print(ans)


print(1110 - int(input()))


print(input().replace('1', '0').replace('9', '1').replace('0', '9'))


l = input()
a = {'1': '9', '9': '1'}
for i in l:
	print(a[i], end='')


n = input()
n = n.replace('9', '@')
n = n.replace('1', '9')
n = n.replace('@', '1')
print(int(n))


a = input()
print(a.translate(str.maketrans({'9': '1', '1': '9'})))


a = input()
d = {'1': 9, '9': 1}
for i in a:
	print(d[i], end='')


print(input().replace('1', 'X').replace('9', '1').replace('X', '9'))


n = input()
out = ''
for s in n:
	if s == '1':
		out += '9'
	else:
		out += '1'
print(out)


n = input()
s = ''
for i in range(3):
	if n[i] == '1':
		s = s + '9'
	else:
		s = s + '1'
print(s)


print(input().replace('9', '4').replace('1', '9').replace('4', '1'))


print(*['1' if s == '9' else '9' for s in input()], sep='')


x = int(input())
print(1110 - x)


d = {'9': '1', '1': '9'}
print(''.join([d[x] for x in input()]))


print(input().replace('1', '8').replace('9', '1').replace('8', '9'))


s = int(input())
print(1110 - s)


print(input().replace('1', '_').replace('9', '1').replace('_', '9'))


n = input()
n = n.translate(str.maketrans('19', '91'))
print(n)


ans = 1110 - int(input())
print(ans)


n = input()
result = ''
for i in n:
	if i == '1':
		result += '9'
	elif i == '9':
		result += '1'
print(result)


s = input()
print(s.translate(str.maketrans({'1': '9', '9': '1'})))


n = int(input())
print(1110 - n)


def main():
	N = input()
	ans = ''
	for n in N:
		if n == '1':
			ans += '9'
		else:
			ans += '1'
	print(ans)

def __starting_point():
	main()
__starting_point()


print(''.join(list(map(lambda x: '9' if x == '1' else '1', input()))))


S = input()
ans = ''
for c in S:
	ans += str(int(c) ^ 8)
print(ans)


print(''.join(['1' if s == '9' else '9' for s in str(input())]))


for i in input():
	print([1, 9][i == '1'], end='')
print()


print(input().translate({ord('1'): '9', ord('9'): '1'}))


print(''.join(map(lambda x: str(10 - int(x)), input())))


r = ''
for i in input():
	r += '9' if i == '1' else '1'
print(r)


s = '19'
n = input()
for i in n:
	print(s[i == '1'], end='')
print()


N = int(input())
M = 1110 - N
print(M)


print(*[{'1': '9', '9': '1'}[i] for i in input()], sep='')


print(''.join([str(int(i) * 9 % 10) for i in input()]))


n = int(input())
p = 1110
print(p - n)


s = input()
for c in s:
	print('9' if c == '1' else '1', end='')


print(''.join(list(('1' if i == '9' else '9' for i in input()))))


n = input()
print(''.join(('1' if c == '9' else '9' for c in n)))


n = input()
i = 0
a = n[i].replace('1', '9') if n[i] == '1' else n[i].replace('9', '1')
i = 1
b = n[i].replace('1', '9') if n[i] == '1' else n[i].replace('9', '1')
i = 2
c = n[i].replace('1', '9') if n[i] == '1' else n[i].replace('9', '1')
print(a + b + c)


s = input()
print(s.translate(str.maketrans('19', '91')))


print(input().replace('1', 'a').replace('9', '1').replace('a', '9'))


n = str(input())
ans = ''
for i in range(3):
	if n[i] == '1':
		ans += '9'
	elif n[i] == '9':
		ans += '1'
print(int(ans))


n = list(input())
ans = ''
for w in n:
	if w == '1':
		ans += '9'
	else:
		ans += '1'
print(ans)


s = input()
ans = ''
for w in s:
	if w == '1':
		ans += '9'
	else:
		ans += '1'
ans = int(ans)
print(ans)


d = {'1': '9', '9': '1'}
print(''.join((d[c] for c in input())))


N = input()
print(N.replace('1', '.').replace('9', '1').replace('.', '9'))


N = input()
N = N.translate(str.maketrans({'1': '9', '9': '1'}))
print(int(N))


n = input()
ans = []
for i in n:
	if i == '1':
		ans.append('9')
	else:
		ans.append('1')
print(''.join(ans))


for i in input():
	print(9 if i == '1' else 1, end='')
print()


print(''.join(map(lambda c: '1' if c == '9' else '9', input())))


number = int(input())
print(111 + 999 - number)


print(input().replace('9', 't').replace('1', '9').replace('t', '1'))


a = int(input())
print(111 + 999 - a)


s = list(input())
for i in range(3):
	if s[i] == '1':
		s[i] = '9'
	else:
		s[i] = '1'
print(''.join(s))


a = input()
for i in range(len(a)):
	if a[i] == '1':
		a = a[:i] + '9' + a[i + 1:]
	elif a[i] == '9':
		a = a[:i] + '1' + a[i + 1:]
print(a)


print(''.join([str(10 - int(x)) for x in input()]))


n = input()
n_list = list(n)
for i in range(3):
	if n_list[i] == '1':
		n_list[i] = '9'
	elif n_list[i] == '9':
		n_list[i] = '1'
n_c = ''.join(n_list)
print(n_c)


n = str(input())
N = n.replace('9', 'x').replace('1', '9').replace('x', '1')
print(N)


(a, b, c) = input()
d = {'1': '9', '9': '1'}
print(d[a] + d[b] + d[c])


print(''.join(['9' if int(x) == 1 else '1' for x in list(input())]))


n = list(input())
for i in range(len(n)):
	if n[i] == '1':
		n.pop(i)
		n.insert(i, '9')
	elif n[i] == '9':
		n.pop(i)
		n.insert(i, '1')
print(int(''.join(n)))


print(input().replace('1', 'd').replace('9', '1').replace('d', '9'))


S = input()
new_s = ''
for s in S:
	if s == '1':
		new_s += '9'
	else:
		new_s += '1'
print(new_s)


n = input()
for i in range(len(n)):
	if n[i] == '1':
		n = n[:i] + '9' + n[i + 1:]
	else:
		n = n[:i] + '1' + n[i + 1:]
print(int(n))


n = list(input())
for i in range(3):
	if n[i] == '1':
		n[i] = '9'
	elif n[i] == '9':
		n[i] = '1'
print(int(''.join(n)))


print(*['9' if i == '1' else '1' for i in input()], sep='')


n = input()
print(n.translate(str.maketrans({'9': '1', '1': '9'})))


def main():
	n = input()
	print(''.join(('9' if s == '1' else '1' for s in n)))
main()


f = lambda c: '1' if c == '9' else '9'
print(''.join(list(map(f, input()))))


n = input()
for i in n:
	print(10 - int(i), end='')


print(input().replace('1', '2').replace('9', '1').replace('2', '9'))


print(''.join(['9' if n == '1' else '1' for n in list(input())]))


n = int(input())
ans = 1110 - n
print(ans)


s = input()
s_list = list(s)
for i in range(len(s)):
	if s[i] == '1':
		s_list[i] = '9'
	elif s[i] == '9':
		s_list[i] = '1'
str_changed = ''.join(s_list)
print(str_changed)


n = int(input())
x = 1110 - n
print(x)


S = input()
for i in S:
	print(10 - int(i), end='')
print()


n = list(input())
for i in range(3):
	if n[i] == '1':
		n[i] = '9'
	else:
		n[i] = '1'
S = ''
for j in range(3):
	S += n[j]
print(S)


n = int(input())
lst_n = list(str(n))
for i in range(len(lst_n)):
	if lst_n[i] == '1':
		lst_n[i] = '9'
	elif lst_n[i] == '9':
		lst_n[i] = '1'
print(''.join(lst_n))


T = int(input())
print(1110 - T)


print(''.join(map(lambda x: {'1': '9', '9': '1'}[x], input())))


n = int(input())
Ans = 1110 - n
print(Ans)


(*S,) = map(lambda x: '1' if x == '9' else '9', input())
print(''.join(S))


l = list(input())
for i in range(len(l)):
	if l[i] == '1':
		l[i] = '9'
	elif l[i] == '9':
		l[i] = '1'
print(''.join(l))


a = ['1' if n == '9' else '9' for n in input()]
print(''.join(a))


print(1110 - int(input().strip()))


print(''.join(('1' if X == '9' else '9' for X in input())))


n = list(input())
for i in range(len(n)):
	if n[i] == '1':
		n[i] = '9'
	else:
		n[i] = '1'
print(''.join(n))


S = input()
ans = ''
for s in S:
	if s == '1':
		ans += '9'
	if s == '9':
		ans += '1'
print(ans)


a = input()
l1 = []
l2 = []
for i in range(len(a)):
	l1.append(a[i:i + 1])
for i in range(len(a)):
	l2.append(str(abs(int(l1[i]) - 10)))
print(''.join(l2))


print(*map('0923456781'.index, input()), sep='')


n = list(str(input()))
ans = ''
for i in n:
	ans += '1' if i == '9' else '9'
print(ans)


a = input()
x = ''
if a[0] == '1':
	x += '9'
else:
	x += '1'
if a[1] == '1':
	x += '9'
else:
	x += '1'
if a[2] == '1':
	x += '9'
else:
	x += '1'
print(x)


n = input()
dst = n.translate(n.maketrans('19', '91'))
print(dst)


s = input()
n = len(s)
q = '1' * n + '0'
print(int(q) - int(s))


n = input()
b = ''
for i in n:
	if i == '1':
		b += '9'
	else:
		b += '1'
print(b)


a = int(input())
print(1000 - a + 110)


a = int(input())
b = 1110 - a
print(b)


print(''.join([{'1': '9', '9': '1'}[c] for c in list(input())]))


n = str(input())
ans = ''
for i in range(3):
	if n[i] == '9':
		ans += '1'
	else:
		ans += '9'
print(ans)


s = list(input())
print(''.join([str(10 - int(i)) for i in s]))


n = input()
s = ''
for i in range(len(n)):
	if n[i] == '1':
		s += '9'
	elif n[i] == '9':
		s += '1'
print(s)


n = input()
m = ''
for x in n:
	if x == '1':
		m += '9'
	elif x == '9':
		m += '1'
	else:
		m += x
print(int(m))


print(*list(map(lambda x: '9' if x == '1' else '1', input())), sep='')


s = list(input())

def slv(i):
	if i == 1 or i == 9:
		return 10 - i
	else:
		return i
print(str(slv(int(s[0]))) + str(slv(int(s[1]))) + str(slv(int(s[2]))))


(a, b, c) = input()
print(str(10 - int(a)) + str(10 - int(b)) + str(10 - int(c)))


a = input()
for i in a:
	print(10 - int(i), end='')
print()


d = {'1': '9', '9': '1'}
s = input()
print(d[s[0]] + d[s[1]] + d[s[2]])


d = {'1': '9', '9': '1'}
l = [d[i] for i in input()]
print(''.join(l))


url = 'https://atcoder.jp//contests/abc111/tasks/abc111_a'

def main():
	s = input()
	print(s.translate(str.maketrans({'1': '9', '9': '1'})))

def __starting_point():
	main()
__starting_point()


s = input()
ans = []
for i in range(3):
	if s[i] == '1':
		ans.append('9')
	else:
		ans.append('1')
print(''.join(ans))


a = list(input())
for i in a:
	if i == '1':
		print('9', end='')
	else:
		print('1', end='')
print()


s_l = [n for n in input()]
new_list = []
for i in s_l:
	if i == '9':
		new_list.append(1)
	else:
		new_list.append(9)
print(''.join(map(str, new_list)))


K = int(input())
print(1110 - K)


a = input()
for i in range(3):
	if a[i] == '1':
		a = a[:i] + '9' + a[i + 1:]
	elif a[i] == '9':
		a = a[:i] + '1' + a[i + 1:]
print(a)


print(input().replace('9', 'Q').replace('1', '9').replace('Q', '1'))


icase = 0
if icase == 0:
	k = int(input())
	print(1110 - k)


N = int(input())
print(1110 - N)


print(''.join(map(lambda x: str(int(x) ^ 8), input())))


n = list(input())
print(''.join(({'1': '9', '9': '1'}[d] for d in n)))


print(input().rstrip().translate(str.maketrans({'9': '1', '1': '9'})))


n = int(input())
print(111 + 999 - n)


print(''.join(['91'[b] for b in map(lambda a: a == '9', input())]))


print(input().replace('1', '5').replace('9', '1').replace('5', '9'))


n = int(input())
if n == 111:
	print('999')
elif n == 119:
	print('991')
elif n == 191:
	print('919')
elif n == 199:
	print('911')
elif n == 911:
	print('199')
elif n == 919:
	print('191')
elif n == 991:
	print('119')
else:
	print('111')


n = input()
for c in n:
	print(10 - int(c), end='')
print()


n = input()
ans = ''
for i in n:
	if i == '9':
		ans += '1'
	else:
		ans += '9'
print(ans)


S = int(input())
print(1110 - S)


ret = ''
for a in input():
	if a == '1':
		ret += '9'
	elif a == '9':
		ret += '1'
	else:
		ret += a
print(ret)


print(input().translate({49: 57, 57: 49}))


n = input()
print(''.join([str(10 - int(i)) for i in n]))


moji = str(input())
ans = ''
for i in range(len(moji)):
	ans += ('1', '9')[moji[i] == '1']
print(ans)


print(''.join([{'1': '9', '9': '1'}[s] for s in input()]))


N = int(input())
result = 1110 - N
print(result)


n = input()
print(*[1 if a == '9' else 9 for a in n], sep='')


print(str(1110 - int(input())))


a = list(input())
for i in range(0, len(a)):
	if a[i] == '1':
		a[i] = '9'
	elif a[i] == '9':
		a[i] = '1'
	print(a[i], end='')


n = input()
d = {'1': '9', '9': '1'}
print(''.join([d[i] for i in n]))


n = input()
x = list()
for i in range(3):
	if n[i] == '1':
		x.append('9')
	else:
		x.append('1')
print(x[0] + x[1] + x[2])


n = int(input())
m = 1110 - n
print(m)


s = input()
a = ''
for i in s:
	a += str(10 - int(i))
print(int(a))


a = int(input())
if a // 100 % 9 == 0:
	b = 100
else:
	b = 900
if (a - a // 100 * 100) // 10 % 9 == 0:
	c = 10
else:
	c = 90
if (a - a // 10 * 10) % 9 == 0:
	d = 1
else:
	d = 9
print(b + c + d)


s = input()
print(int(''.join(['1' if c == '9' else '9' for c in s])))


n = int(input())
print(abs(1110 - n))


n = list(input())
for i in range(3):
	if n[i] == '1':
		n[i] = 9
	else:
		n[i] = 1
print(n[0], n[1], n[2], sep='')


n = input()
print(''.join(('1' if s == '9' else '9' for s in n)))


import sys
import numpy as np
import math
sList = list(str(input()))
for i in range(3):
	if sList[i] == '1':
		sList[i] = '9'
	else:
		sList[i] = '1'
print(''.join(sList))


tran = str.maketrans('19', '91')
print(input().translate(tran))


n = int(input())
z = 1110 - n
print(int(z))


n = input()
ans = n.replace('1', 'q').replace('9', 'i').replace('q', '9').replace('i', '1')
print(ans)


n = int(input())
if (n - n % 100) / 100 == 1:
	n += 800
else:
	n -= 800
if (n % 100 - n % 100 % 10) / 10 == 1:
	n += 80
else:
	n -= 80
if n % 10 == 1:
	n += 8
else:
	n -= 8
print(n)


n = int(input())
a = 1110 - n
print(a)


print(''.join(['9' if s == '1' else '1' for s in list(input())]))