Problem:
 Score : 100 points    Problem Statement 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 1 119      Sample Output 1 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 .       Sample Input 2 999      Sample Output 2 111

Solution (Python):


def main():
    s = raw_input().strip()
    retval = ""
    for c in s:
        if c == '1':
            retval += '9'
        elif c == '9':
            retval += '1'
        else:
            retval += c
    print retval

if __name__ == '__main__':
    main()

Solution (Python):
print(1110-int(input()))

Solution (Python):
n = input()
ans = []
for i in range(len(n)):
    if n[i] == '1':
        ans.append('9')
    elif n[i] == '9':
        ans.append('1')

print(''.join(ans))

Solution (Python):



import sys  
import os
import time
import re
from pydoc import help
import string
import math
from operator import itemgetter
from collections import Counter
from collections import deque
from collections import defaultdict as dd
import fractions
from heapq import heappop, heappush, heapify
import array
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy as dcopy
import itertools



sys.setrecursionlimit(10**7)
INF = 10**20
GOSA = 1.0 / 10**10
MOD = 10**9+7
ALPHABETS = [chr(i) for i in range(ord('a'), ord('z')+1)]  
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def DP(N, M, first): return [[first] * M for n in range(N)]
def DP3(N, M, L, first): return [[[first] * L for n in range(M)] for _ in range(N)]
from inspect import currentframe
def dump(*args):
    names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' => '+repr(arg) for arg in args), file=sys.stderr)


def local_input():
    from pcm.utils import set_stdin
    import sys
    if len(sys.argv) == 1:
        set_stdin(os.path.dirname(__file__) + '/test/' + 'sample-1.in')

def solve():
    s = input()
    res = ""
    for c in s:
        if c=='9':
            res += '1'
        else:
            res += '9'
    print(res)
    return 0

if __name__ == "__main__":
    try:
        local_input()
    except:
        pass
    solve()

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

Solution (Python):
n = raw_input()
s = ""
for c in n:
    if c == '1':
        s = s + '9'
    elif c == '9':
        s = s + '1'
    else:
        s = s + c
print s

Solution (Python):
print 1110 - input()

Solution (Python):
number=int(input())
h=int(number/100)
t=int(number/10)-h*10
o=int(number-100*h-10*t)

if h==1:
    h=9
elif h==9:
    h=1

if t==1:
    t=9
elif t==9:
    t=1

if o==1:
    o=9
elif o==9:
    o=1

print(h*100+t*10+o)

Solution (Python):
n = int(input())
li = list(map(int,str(n)))
num = ""

for i in li:
    if i == 1:
        num += str(9)
    else:
        num += str(1)

print(int(num))

Solution (Python):
s = input()
mir = s.replace("1","
mir2 = mir.replace("9","1")
print(mir2.replace("

Solution (Python):

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

Solution (Python):
n=input()
n=n.replace('1','2')
n=n.replace('9','1')
n=n.replace('2','9')
print(n)

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

Solution (Python):

n = input()

for i in range(3):
    if n[i] == "1":
        print("9", end="")
    elif n[i] == "9":
        print("1", end="")
    else:
        print(n[i], end="")

print()

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

Solution (Python):
n = input()
ans = ""
for i in n:
    if i == "1":
        ans += "9"
    else:
        ans += "1"
print(int(ans))

Solution (Python):
n = int(input())
print(1110 - n)

Solution (Python):
n = input()
ans = ""
for i in n:
    if i == "1":
        ans = ans + "9"
    else:
        ans = ans + "1"
print(int(ans))

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

Solution (Python):
def getinputdata():

    array_result = []    
    array_result.append(input().split(" "))

    flg = True

    try:
        while flg:

            data = input()

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = True

            else:

                flg = False
    finally:

        return array_result

arr_data = getinputdata()

n=int(arr_data[0][0])

print(111+999-n)

Solution (Python):
N = str(input())
K = []
for i in range(3):
    if N[i] == "1":
        K.append("9")
    elif N[i] =="9":
        K.append("1")
    else:
        K.append(N[i])

print(K[0]+K[1]+K[2])

Solution (Python):
n = int(input())
print(1110 - n)

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

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

Solution (Python):
n = int(input())
strN = str(n)

strN = strN.replace('1', 'a')
strN = strN.replace('9', '1')
strN = strN.replace('a', '9')

print(strN)

Solution (Python):
a=list(input())
l=""
for i in a:
    if i=="9":
        l+="1"
    else:
        l+="9"
print(l)

Solution (Python):
n = int(input())

ans = 0
if (int(n / 100)) == 9:
  ans = 100
else:
  ans = 900

if int((n % 100) / 10) == 9:
  ans = ans + 10
else:
  ans = ans + 90

if (n % 10) == 9:
  ans = ans + 1
else:
  ans = ans + 9

print(str(ans))

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

Solution (Python):
s=input()
result=''
for i in range(len(s)):
    if int(s[i])-1:
        result+='1'
    else:
        result+='9'
print(result)

Solution (Python):
s = input()
s = s.replace('1', '2')
s = s.replace('9', '1')
s = s.replace('2', '9')
print(s)

Solution (Python):
s = input()

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

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

Solution (Python):
n = str(input())
list_n = list(n)
for i in range(3):
    if list_n[i] == "9":
        list_n[i] = "1"
    else:
        list_n[i] = "9"
print("".join(list_n))

Solution (Python):
n=str(input())
new_n = ''
for number in n:
    if number == '1':
        new_n += '9'
    else:
        new_n += '1'

print(int(new_n))

Solution (Python):
n = input()

ret = ''
if n[0]=='1':
    ret +='9'
else:
    ret += '1'

if n[1]=='1':
    ret+='9'
else:
    ret+='1'

if n[2]=='1':
    ret+='9'
else:
    ret+='1'

print(ret)

Solution (Python):
n = str(input())
m = ""
for c in n:
    if c == "1":
        c = "9"
    elif c == "9":
        c = "1"
    m += c
print(m)

Solution (Python):
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

s = lc()
ans = []

for si in s:
    if si == "1":
        ans.append("9")
    else:
        ans.append("1")
        
print("".join(ans))

Solution (Python):
s = input()
cha = list(s)
answer = []
for hoge in cha:
  if hoge == '1':
    answer.append('9')
  else:
    answer.append('1')
print(''.join(answer))

Solution (Python):
s = input()
cha = list(s)
answer = []
for hoge in cha:
  if hoge == '1':
    answer.append('9')
  else:
    answer.append('1')
print(''.join(answer))

Solution (Python):
n=input()
n=int(n)
nf= n%10
ns =  (n-nf)%100
nt = n-nf-ns

if nf==1 :
    nf=9
elif nf==9:
    nf=1


if ns==10 :
    ns=90
elif ns==90:
    ns=10


if nt==100:
    nt=900
elif nt==900:
    nt=100
    
n=nf+ns+nt


print(n)

Solution (Python):
n = input()
ans = ""
for i in n:
    if i == "1":
        ans += "9"
    else:
        ans += "1"

print(ans)

Solution (Python):
a = input()
a = a.replace('1', 'x')
a = a.replace('9', '1')
a = a.replace('x', '9')
print(a)

Solution (Python):
n = list(raw_input())
for i in range(3):
    if n[i] == '1':
        n[i] = '9'
    else:
        n[i] = '1'
print(int(n[0]+n[1]+n[2]))

Solution (Python):
n = input()
j = ''

for i in n:
    if i == '1':
        j += '9' 
    else:
        j += '1'

print(j)

Solution (Python):
a=input()
a=a.replace("1","a")
a=a.replace("9","1")
a=a.replace("a","9")
print(a)

Solution (Python):
n = int(input())
print(1110 - n)

Solution (Python):
print(str(input()).replace('1', '8').replace('9','1').replace('8','9'))

Solution (Python):
inp = input()
inp = inp.replace("1", "_").replace("9", "-").replace("_", "9").replace("-", "1")
print(inp)

Solution (Python):
N = input()
print(N.replace("1", "x").replace("9", "1").replace("x", "9"))

Solution (Python):


n = int(input())
ans = ""

for i in str(n):
    if int(i) == 1:
        i = 9
    elif int(i) == 9:
        i = 1

    ans = ans + str(i)

print(int(ans))

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

Solution (Python):
n = str(input())
ans = ""
for i in n:
    if i == "9":
        ans += "1"
    else:
        ans += "9"
print(ans)

Solution (Python):
n = input()
out = []
for i in n:
    if i == "1":
        out.append("9")
    else:
        out.append("1")
print("".join(out))

Solution (Python):
n  = int(input())
print(1110-n)

Solution (Python):
N = input()

list_N  = list(str((N)))





def swap(i):
    if i == "9":
        re = "1"
    elif i=="1":
        re = "9"
    return re

swap_N = list(map(swap, list_N))
print(int("".join(swap_N)))

Solution (Python):
n = input()

out = []
for char in n:
    if char == "1":
        out.append("9")
    else:
        out.append("1")

print("".join(out))

Solution (Python):
S = input()
L = []
for i in S:
    if i == "1":
        L.append(9)
    elif i == "9":
        L.append(1)
    else:
        L.append(i)
        
print("".join(map(str, L)))

Solution (Python):
n = map(int, input())
result = ''
for i in n:
    if int(i) == 1:
        result = result + str(9)
    else:
        result = result + str(1)
print(int(result))

Solution (Python):
n = list(input())
for i in range(3):
    if n[i] == "1":
        n[i] = "9"
    else:
        n[i] = "1"

for i in range(3):
    if i != 2:
        print(n[i],end = "")
    else:
        print(n[i])

Solution (Python):
n = str(input())
a = ""
for i in n:
    if i == '1':
        a = a + '9'
    else:
        a = a + '1'
print(a)

Solution (Python):
n = list(input())
result = ''
for num in n:
    if num == '1':
        result += '9'
    elif num == '9':
        result += '1'
print(int(result))

Solution (Python):
n_str = input()
n_list = []

for str in n_str:
    if str == '1':
        n_list.append('9')
    else:
        n_list.append('1')

ans = "".join(n_list)

print(int(ans))

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

Solution (Python):
print(1110-int(input()))

Solution (Python):
n = input()
ans = ''
for i in range(len(n)):
 if n[i]=='1':
  ans+='9'
 else:
  ans+='1'

print(ans)

Solution (Python):
n = int(input())

nl = list(str(n))

for i in range(len(nl)):
    if nl[i] == '9':
        nl[i] = '1'
    elif nl[i] == '1':
        nl[i] = '9'

print(int(''.join(nl)))

Solution (Python):
n = input()
a = ''
for i in n:
    if i == '1':
        a += '9'
    else:
        a += '1'

print(a)

Solution (Python):
N=int(input())
print(1110-N)

Solution (Python):
N=int(input())
print(1110-N)

Solution (Python):
N=int(input())
print(1110-N)

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

Solution (Python):
str = input()
a = list(str)
for i in range(len(a)):
    if a[i] == '1':
        a[i] = '9'
    else :
        a[i] = '1'
print("".join(a))

Solution (Python):
n = int(input())

m = 1110 - n

print(m
)

Solution (Python):
n = input()
a,b,c = n[0],n[1],n[2]
if a=="1":
  a="9"
elif a=="9":
  a="1"
if b=="1":
  b="9"
elif b=="9":
  b="1"
if c=="1":
  c="9"
elif c=="9":
  c="1"
print(a+b+c)

Solution (Python):
n = input()
a = ""
for i in range(3):
    if n[i] == "1":
        a += "9"
    else:
        a += "1"
print(a)

Solution (Python):
import sys


def solve(a):
    return 1110-a


def readQuestion():
    line = sys.stdin.readline().rstrip()
    return int(line)

def main():
    n = readQuestion()
    answer = solve(n)
    print(answer)
    
if __name__ == '__main__':
    main()

Solution (Python):
n = [a for a in input()]
for i in range(len(n)):
  if n[i] == "1":
    n[i] = "9"
  elif n[i] == "9":
    n[i] = "1"
print("".join(n))

Solution (Python):
n=list(input())
s=""
for i in range(len(n)):
    if n[i]=="1":
        n[i]="9"
    else:
        n[i]="1"
    s=s+n[i]
print(s)

Solution (Python):
n=str(input())
for string in n:
    print('1',end='') if string == '9' else print('9',end='')

Solution (Python):
n = int(input())
ans = 1110 - n
print(ans)

Solution (Python):
n = int(input())
ans = 1110 - n
print(ans)

Solution (Python):
n = input()
result = ""
for i,c in enumerate(n):
	if c == "1":
		result += "9"
	else:
		result += "1"
print(result)

Solution (Python):



input = raw_input()

result = " "
for i in range(0, 3):
    if input[i] == "1":
        result += "9"
    elif input[i] == "9":
        result += "1"
    else:
        result += input[i]

print int(result)

Solution (Python):
s = list(input())
t = ''
for i in range(3):
    if(s[i] == '1'):
        t += '9'
    else:
        t += '1'

print(t)

Solution (Python):
n = input()
 
arr = list(n)
output = ""
for e in arr:
  if e == '1':
    output += '9'
  else:
    output += '1'
 
print(output)

Solution (Python):
import sys

N = sys.stdin.readline().strip()
L = str(N)
L = L.translate(str.maketrans({'1': '9', '9': '1'}))
print(L)

Solution (Python):
n=input()
s=""
for i in n:
    if i=='1':
        s+='9' 
    elif i=='9':
        s+='1'
    else:
        s+=i 
print(s)

Solution (Python):
inp = input()
ret = ""
for i in range(3):
    if inp[i] == '1':
        ret += "9"
    if inp[i] == '9':
        ret += "1"
print(ret)

Solution (Python):
print(input().replace("1", "8").replace("9", "2").replace("8", "9").replace("2", "1"))

Solution (Python):
from sys import stdin

n = stdin.readline().rstrip()

list = []
for i in range(3):
    list.append(n[i])

if list[0] == '1':
    list[0] = '9'
else:
    list[0] = '1'
if list[1] == '1':
    list[1] = '9'
else:
    list[1] = '1'
if list[2] == '1':
    list[2] = '9'
else:
    list[2] = '1'

ans = ''.join(list)

print(ans)

Solution (Python):
ns = list(map(str, input()))
s = ''
for n in ns:
  if n == '1':
    s += '9'
  else:
    s += '1'
print(s)

Solution (Python):



a = int(raw_input())


a1 = a/100 
a = a%100
a2 = a/10  
a = a%10
a3 = a     







if a1 == 1:
    a1 = 9
else:
    if a1 == 9:
        a1 = 1

if a2 == 1:
    a2 = 9
else:
    if a2 == 9:
        a2 = 1

if a3 == 1:
    a3 = 9
else:
    if a3 == 9:
        a3 = 1

print a1*100 + a2*10 + a3

Solution (Python):

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

Solution (Python):
n = list(input())
r = []
for i in n:
    if i == "1":
        r.append("9")
    else:
        r.append("1")
print("".join(r))

Solution (Python):
num = input()
a = []

for i in range(3):
    a.append(num[i])
for i in range(3):
    if a[i] == '1':
        a[i] = '9'
    elif a[i] == '9':
        a[i] = '1'

print(a[0] + a[1] + a[2])

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

Solution (Python):
X = input()
Xn = X.replace("1","N")
Xo = Xn.replace("9","1")
print(Xo.replace("N","9"))

Solution (Python):
n = int(input())
p = 1110

print(p-n)

Solution (Python):
n = [a for a in str(input())]
for i in range(3):
    if n[i] == "1":
        n[i] = "9"
    else:
        n[i] = "1"

print(n[0] + n[1] + n[2])

Solution (Python):
from functools import reduce
n=int(input())
s=[int(x) for x in list(str(n))]
for i in range(0,len(s)):
    if s[i]==1:
        s[i]=9
    else:
        s[i]=1
print(int(reduce(lambda x, y: x + y, [str(x) for x in s])))

Solution (Python):
n = input()
n = n.replace('1', 't').replace('9', '1').replace('t', '9')
print(n)

Solution (Python):
s = int(input())
print(1110 - s)

Solution (Python):
N = input()
n = list(N)
con = []
for i in range(len(n)):
    if n[i] == '1':
        con += '9'
    elif n[i] == '9':
        con += '1'
    else:
        con += n[i]
result = ''.join(con)
print(result)

Solution (Python):
n = input()

for c in n:
	if c == '1':
		c = '9'
	else:
		c = '1'

	print(c,end="")

print()

Solution (Python):
print(input().replace("9","4").replace("1","9").replace("4","1"))

Solution (Python):
ans = int(input())
print(1110-ans)

Solution (Python):
a = input()


ans = a.replace('1', 'n')
ans = ans.replace('9', '1')
ans = ans.replace('n', '9')
print(ans)

Solution (Python):
n = int(input())
m = 10 - n % 10
m += (10 - (n // 10) % 10) * 10
m += (10 - n // 100) * 100
print(m)

Solution (Python):
s = input()

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

Solution (Python):
n_list = list(input().rstrip())
result_list = []

for num in n_list:
  if num == '1':
    result_list.append('9')
  elif num == '9':
    result_list.append('1')
  else:
    result_list.append(num)

print(''.join(result_list))

Solution (Python):
n=input()

def change_1_9(n):
    answer=[]
    for i in range(len(n)):
        if n[i]=='1':
            answer.append(9)
        else:
            answer.append(1)   

    final_answer=''
    for n in range(len(answer)):
        final_answer+=str(answer[n])
    
    return final_answer  
  
print(int(change_1_9(n)))

Solution (Python):
s = input()
 
ans = ''
for w in str(s):
    if w == '1':
        ans += '9'
    elif w == '9':
        ans += '1'
        
print(int(ans))

Solution (Python):
n = int(input())
if n % 10 == 1:
    m = 9
else:
    m = 1
if (n // 10) % 10 == 1:
    m += 90
else:
    m += 10
if (n // 100) % 10 == 1:
    m += 900
else:
    m += 100
print(m)

Solution (Python):
s = input()
print(s.replace("1","8").replace("9","1").replace("8","9"))

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

Solution (Python):
s = input();

r = ""
for i in s:
	if i=='1':
		r += '9'
	else :
		r += '1'

print(r)

Solution (Python):
print(1110-int(input()))

Solution (Python):
print(1110 - int(input()))

Solution (Python):
n = input().replace('9', 'N')
n = n.replace('1', 'O')
n = n.replace('N', '1')
n = n.replace('O', '9')
print(n)

Solution (Python):
N = input()
s = ''
for n in N:
    if n == '1':
        s += '9'
    elif n == '9':
        s += '1'
    else:
        s += n
print(s)

Solution (Python):
num_list = list(map(int,input()))

answer = ""

for check_num in num_list:
    if check_num == 1:
        ans_num = 9
    else:
        ans_num = 1


    answer = answer + str(ans_num)
print(answer)

Solution (Python):
n = input()
n = n.replace("1","a")
n = n.replace("9","1")
n = n.replace("a","9")
print(n)

Solution (Python):
n = raw_input()
c = ''
for i in n:
    if i == '1':
        c+='9'
    else:
        c+='1'
print(c)

Solution (Python):
S = int(input())
print(1110-S)

Solution (Python):
import sys
import math
import collections
import itertools
import array
import inspect


sys.setrecursionlimit(1000000)



def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))



def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v



def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk



def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def bisearch(L, target):
    low = 0
    high = len(L) - 1
    
    while low <= high:
        mid = (low + high) // 2
        guess = L[mid]
        if guess == target:
            return True
        elif guess < target:
            low = mid + 1
        elif guess > target:
            high = mid - 1
    if guess != target:
        return False



dp = None


def main():
    N = input()

    for n in N:
        if n == "1":
            print("9", end="")
        elif n == "9":
            print("1", end="")
        else:
            print(n, end="")
    
    print()


main()

Solution (Python):
n = input()
m = ''
for i in n:
    if i == '1':
        m += '9'
    else:
        m += '1'
print(int(m))

Solution (Python):
n = int(input())
print(1110-n)

Solution (Python):
S=str(input())
ans=''
for i in range(3):
    if S[i]=='1':
        ans += '9'
    elif S[i]=='9':
        ans += '1'

print(ans)

Solution (Python):
n_list = list(map(int,input()))
n_str = ""

for i in n_list:
  if i == 1:
    i = 9
  else:
    i = 1
  n_str = n_str + str(i)

print(n_str)

Solution (Python):
n = list(input())

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

print(int(''.join(n)))

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

Solution (Python):
print(input().replace("1","l").replace("9","1").replace("l","9"))

Solution (Python):
import sys


def solve(n):
    answer = 1110 - n
    return answer


def readQuestion():
    line = sys.stdin.readline().rstrip()
    return int(line)

def main():
    n = readQuestion()
    answer = solve(n)
    print(answer)
    
if __name__ == '__main__':
    main()

Solution (Python):
hoge = input()
n = []
for i in hoge:
    if i == "1":
        n.append('9')
    elif i == "9":
        n.append('1')
    else:
        n.append(i)

res = ''.join(n)
print(res)

Solution (Python):

x = input()

xx  = ""

for i in x:
    if i == '9':
        xx += '1'
    elif i == '1':
        xx += '9'
    else:
        xx += i

print(xx)

Solution (Python):
print 1110-input()

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

Solution (Python):
s = raw_input()
ans = ''
for i in range(0, 3):
	if s[i] == '1': ans = ans + '9'
	else: ans = ans + '1'

print ans

Solution (Python):
n=int(input())

print(1110-n)

Solution (Python):
n=int(input())

print(1110-n)

Solution (Python):
N = int(input())

result = 1110 - N

print(result)

Solution (Python):
n = input()
t = ""
for i in range(len(n)):
    if n[i] == "1":
        t += "9"
    else:
        t += "1"

print(t)

Solution (Python):
n = int(input())
a = 1110-n
print(a)

Solution (Python):
try:
    s = input() 
    ans = ''
    i = 0
    while i < len(s):
        ans += '9' if s[i] == '1' else '1'
        i = i + 1
    print(ans)
except EOFError:
    pass

Solution (Python):
n = input()
res = ""
for i in n:
	if i == '1':
		res += '9'
	else:
		res += '1'
print(int(res))

Solution (Python):
b=input()
for c in b:
    if(c=='1'):
        print('9',end='')
    elif (c=='9'):
        print('1',end='')
    else:
        print(c,end='')

Solution (Python):
N = input()

Ans = ""
for n in N:
    if n=="1":
        Ans += "9"
    else:
        Ans += "1"

print(Ans)

Solution (Python):
n = input()
for i in n:
    if i == "1":
        print(9, end = "")
    else:
        print(1, end = "")
print()

Solution (Python):


n = list(input())
ans=[]
for i in n:
    if i =="1":
        ans.append(9)
    else:
        ans.append(1)

for i in ans:
    print(i,end="")

Solution (Python):
number = input()
number = number.replace("1","
number = number.replace("9","1")
number = number.replace("
        
print(number)

Solution (Python):
n = input()
for i in n:
    print(1 if i=="9" else 9,end="")
print("")

Solution (Python):
def out(text):
    print(text, end='')

n = list((input()))
for i in n:
    if i == '9':
        out(1)
    elif i == '1':
        out(9)

Solution (Python):
n = str(input())
m = ""
for i in range(3):
  if n[i] == "9":
    m += "1"
  elif n[i] == "1":
    m += "9"
  else:
    m += n[i] 
print(int(m))

Solution (Python):


list_r = []
line = int(input())
line_a = list(map(int, [line/100, (line%100)/10, line%10]))
for i in range(3):
    
    list_r.append(10-line_a[i])
print(''.join(map(str, list_r)))

Solution (Python):
n = list(map(str,input()))
n_length=len(n)


for i in range(n_length):
    if n[i]=='1':
        n[i]='9'
    elif n[i]=='9':
        n[i]='1'
    else:
        pass
n_new=''.join(n)
print(str(n_new))

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

Solution (Python):
n = int(input())
print(1110 - n)

Solution (Python):
print(input().translate(str.maketrans("19","91")))

Solution (Python):
print(input().translate(str.maketrans({"1":"9","9":"1"})))

Solution (Python):
a = input();print(a.replace("9","a").replace("1","9").replace("a","1"))

Solution (Python):
print(str(1110 - int(input())))

Solution (Python):
def answer(in0):

    result = ''

    for ch in str(in0):
        if ch == '9':
            result += '1'
        elif ch == '1':
            result += '9'

    return result


print(answer(input()))

Solution (Python):
print(1110-int(input()))

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

Solution (Python):


s=raw_input()
t=''
for i in xrange(len(s)):
 if s[i]=='1':
  t+='9'
 else:
  t+='1'
print t

Solution (Python):



n = list(input())
m = ""
for i in n:
    if int(i) == 1:
        m += "9"
    if int(i) == 9:
        m += "1"

print(int(m))

Solution (Python):

n = input()

re = ''
for s in n:
    if s == '1':
        s = '9'
    elif s == '9':
        s = '1'
    re += s
    
print(re)

Solution (Python):
n = input()

ans = ""
for w in n:
    ans += "1" if w == "9" else "9"

print(ans)

Solution (Python):
n = int(input())
print(1110 - n)

Solution (Python):
n = input()
n = n.replace('1', 'x')
n = n.replace('9', '1')
n = n.replace('x', '9')
print(n)

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

Solution (Python):
print 1110-input()

Solution (Python):
print(1110-int(input()))

Solution (Python):

from sys import stdin

a = int(stdin.readline().rstrip())

print(111 + 999 - a)

Solution (Python):
s = input()

print(s.translate(str.maketrans("19", "91")))

Solution (Python):
n=input()
s=""
for i in n:
  if i=="1":
    s+="9"
  elif i=="9":
    s+="1"
  else:
    s+=i
print(s)

Solution (Python):
print(1110-int(input()))

Solution (Python):
print(1110-int(input()))

Solution (Python):
n=int(input())
Ans=1110-n
print(Ans)

Solution (Python):
print(1110-int(input()))

Solution (Python):
print(1110-int(input()))

Solution (Python):
instr = input()
ans = ""
for c in instr:
    if c == '1':
        ans += '9'
    elif c == '9':
        ans += '1'
    else:
        ans += c
print(ans)

Solution (Python):
n = input()
n = n.replace('1', 'X').replace('9','1').replace('X','9')
print(n)

Solution (Python):
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(n)

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

Solution (Python):
import math

while True:
    try:
        str = input().strip()
        for i in str:
            if i == '1':
                print(9,end="")
            else:
                print(1,end="")

        print()

    except:
        break

Solution (Python):
print(1110-int(input()))

Solution (Python):
S=input()
T=""
for i in S:
  if i=="1":
    T=T+"9"
  elif i=="9":
    T=T+"1"
  else:
    T=T+i
print(T)

Solution (Python):
n = input()
s = ""
for i in n:
    if i == "1":
        s += "9"
    else:
        s += "1"
print(s)

Solution (Python):
S = input()

S = S.replace("1", "x").replace("9", "1").replace("x", "9")

print(S)

Solution (Python):
num = input()
alt_num = (num.translate(str.maketrans({'1': '9','9': '1'})))
print(alt_num)

Solution (Python):
n = int(input())
num = []
while n != 0:
  num.append(n%10)
  n -= n%10
  n /= 10
a=num[2]
b=num[1]
c=num[0]
d=0
e=0
f=0
if a==9:
  d=1
elif a==1:
  d=9
else:
  d=a
if b==9:
  e=1
elif b==1:
  e=9
else:
  e=b
if c==9:
  f=1
elif c==1:
  f=9
else:
  f=c
print(int(100*d+10*e+f))

Solution (Python):
N = int(input())

if N==111 :
    print("999")
elif N== 119:
    print("991")
elif N== 191:
    print("919")
elif N== 911:
    print("199")
elif N== 199:
    print("911")
elif N== 919:
    print("191")
elif N== 991:
    print("119")
elif N== 999:
    print("111")

Solution (Python):
n=int(input())
print(1110-n)

Solution (Python):
N = str(input())

str_len = len(N)
n = list(N)
for i in range(str_len):
    if n[i] is "9":
        n[i] = "1"
    elif n[i] is "1":
        n[i] = "9"

moji = str()
for i in n:
    moji += i

print(moji)

Solution (Python):
n=input()

ans=""
for i in range(len(n)):
  if n[i]=="1" :
    ans+="9"
  elif n[i]=="9" :
    ans+="1"

print(ans)

Solution (Python):
N = list(map(int,list(input())))
ans = ''
for i in N:
    if i == 1:
        ans = ans+'9'
    else:
        ans = ans + '1'

print(ans)

Solution (Python):
i = int(input())
lst = []
while i > 0:
    
    a=i%10
    
    if a==1:
        a=9
    else:
        a=1
    
    lst.append(a)
    i //= 10
lst.reverse()
print(lst[0]*100+lst[1]*10+lst[2])