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



Sample input:
119


Sample output:
991

Submission status: Accepted

Solution code:
# 任意の桁をstrを通じて抽出する方法
n = list(map(int,list(input())))
ans = 0
for i in n:
  ans = 10*ans+(1 if i==9 else 9 if i==1 else i)
print(ans)

Submission status: Accepted

Solution code:
a = list(input())
b = []
for i in a:
  if i == "1":
    b.append("9")
  else:
    b.append("1")
print("".join(b))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
v = list(input())
v2 = list()

for i in v: 
  if(i == '9'):
    v2.append('1')
  else:
    v2.append('9')
    
print("".join(v2))

Submission status: Accepted

Solution code:
n = input()

res = ""
for s in n:
    if s == "1":
        res += "9"
    else:
        res += "1"

print(int(res))

Submission status: Accepted

Solution code:
N = list(str(input()))
if N[0] == '9':
    N[0] = '1'
else : 
    N[0] = '9'
if N[1]=='9':
    N[1] = '1'
else:
    N[1] = '9'
if N[2] == '9':
    N[2] = '1'
else:
    N[2] = '9'
print(N[0]+N[1]+N[2])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
a = list(str(n))
for i in range(3):
    if a[i]=="1":
        a[i]="9"
    elif a[i]=="9":
        a[i]="1"
ans = ""
for i in a:
    ans+=i 
print(int(ans))

Submission status: Accepted

Solution code:
x = [int(i) for i in input()]

for i in range(len(x)):
  if x[i] == 1:
    x[i] = "9"
  elif x[i] == 9:
    x[i] = "1"
    
print("".join(x))

Submission status: Accepted

Solution code:
print(input().replace("9", "t").replace("1", "9").replace("t", "1"))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

ans = ""
for s in S:
  if s == "1":
    ans += "9"
  elif s == "9":
    ans += "1"

print(ans)

Submission status: Accepted

Solution code:
n = input()
n = n.replace("1","A")
n = n.replace("9","B")
n = n.replace("A","9")
n = n.replace("B","1")
print(int(n))

Submission status: Accepted

Solution code:
X = input()
for i in range(len(X)):
    if X[i] == '1':
        print('9', end='')
    elif X[i] == '9':
        print('1', end='')

Submission status: Accepted

Solution code:
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)))

Submission status: Accepted

Solution code:
n = input()
def flip(s):
	if s == "9":
		return "1"
	elif s == "1":
		return "9"
	else:
		print("komattanaa")
l = []
for i in range(3):
	l.append(flip(n[i]))
print("".join(l))

Submission status: Accepted

Solution code:
n = input()

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

Submission status: Accepted

Solution code:
n = int(input())
n2 = list(str(n))

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

n2 = ''.join(n2)
print(int(n2))

Submission status: Accepted

Solution code:
print("".join("1"if i=="9"else"9"for i in input()))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve():
    s = input()
    return "".join(["9" if c == "1" else "1" for c in s])


if __name__ == "__main__":
    print(solve())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = str(input())
print(n.replace("1", "*").replace("9", "1").replace("*", "9"))

Submission status: Accepted

Solution code:
n = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
ans = []
for s in input():
    if s == '1':
        ans.append('9')
    elif s == '9':
        ans.append('1')

print(*ans, sep='')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = list(input())

for i in n:
    if i == '1':
        print('9',end="")
    elif i == '9':
        print('1',end="")
print("")

Submission status: Accepted

Solution code:
print(str(input()).replace('1','0').replace('9','1').replace('0','9'))

Submission status: Accepted

Solution code:
print (input().replace("1", "x").replace("9", "1").replace("x", "9"))

Submission status: Accepted

Solution code:
def test():
    a = list(map(int,input()))
    for i in range(len(a)):
        if a[i] == 1:
            a[i] = 9
        elif a[i] == 9:
            a[i] = 1

    print("".join(map(str,a)))



if __name__ == "__main__":
    test()

Submission status: Accepted

Solution code:
import math

# inputList=[]
# for i in range(6):
#     inputNum = input()
#     inputList.append(inputNum)
inputa = input().split()
# inputb = input().split()

# a = int(inputa[0])
# b = int(inputa[1])
# c = int(inputa[2])

# x = int(inputb[0])
# y = int(inputb[1])

inputList = list(inputa[0])



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

ans = "".join(inputList)
print(ans)

Submission status: Accepted

Solution code:
n=int(input())

N=[0]*3
m=[0]*3

N[0]=int(n/10)
N[1]=int(N[0]/10)
N[2]=int(N[1]/10)

m[0]=int(n%10)
m[1]=int(N[0]%10)
m[2]=int(N[1]%10)

for i in range(0,3):
    if m[i]==1:
        m[i]=9
    elif m[i]==9:
        m[i]=1

print(int(m[2]*100+m[1]*10+m[0]))

Submission status: Accepted

Solution code:
i = input()

k = []

for j in i:
    if j == '1':
        k.append('9')
    else:
        k.append('1')

print(''.join(k))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
print(input().replace("9","t").replace("1","9").replace("t","1"))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
print(input().replace("1","n").replace("9","1").replace("n","9"))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=[i for i 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))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
print(''.join(['9' if i == '1' else '1' for i in input()]))

Submission status: Accepted

Solution code:
s = input()
s =s.replace('1', 'a')
s =s.replace('9', 'b')
s =s.replace('a', '9')
s =s.replace('b', '1')
print(s)

Submission status: Accepted

Solution code:

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

print('')

Submission status: Accepted

Solution code:
n = list(input())

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

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

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

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

Submission status: Accepted

Solution code:
n = input()
ans = 0
for i in range(3):
  if n[i] == '1':
    ans += 10**(2-i) * 9
  else:
    ans += 10**(2-i) * 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = [s for s in input()]
for i in range(len(n)):
  if n[i] == "1":
    n[i] = "9"
  else:
    n[i] = "1"
print(int("".join(n)))

Submission status: Accepted

Solution code:
a = [i for i in input()]
for j in range(3):
  if a[j] =="1":
    a[j] = "9"
  else:
    a[j] = "1"
print(a[0]+a[1]+a[2])

Submission status: Accepted

Solution code:
s = input()
ans = ""
 
for i in range(len(s)):
    if s[i] == "1":
        ans += "9"
    else:
        ans += "1"
print(int(ans))

Submission status: Accepted

Solution code:
s = input()
ans = ""

for i in range(len(s)):
    if s[i] == "1":
        ans += "9"
    else:
        ans += "1"
print(int(ans))

Submission status: Accepted

Solution code:
input_line = str(input())
s = []

for i in range(len(input_line)):
    if input_line[i] == '9':
        s.append('1')
    elif input_line[i] == '1':
        s.append('9')
    else:
        s.append(input_line[i])

mojiretu = ''

for x in s:
    mojiretu += x

print(int(mojiretu))

Submission status: Accepted

Solution code:
n = input()

ret = ''

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N = input()
    N = N.replace('9','X').replace('1','Y')
    N = N.replace('X','1').replace('Y','9')
    
    print(int(N))




if __name__ == '__main__' :
    main()

Submission status: Accepted

Solution code:
l = list(input())
for i,v in enumerate(l):
    if v == '1':
        l[i] = '9'
    else:
        l[i] = '1'
print(''.join(l))

Submission status: Accepted

Solution code:
#11:40
n = input()
ans = 0
for i in range(3):
  if n[i] == '1':
    ans += 10**(2-i) * 9
  else:
    ans += 10**(2-i) * 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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='')

Submission status: Accepted

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

def main():
	s = input().strip()
	for c in s:
		if c == '1':
			print('9', end='')
		elif c == '9':
			print('1', end='')
		else:
			print(c, end='')
	print('')
if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:
n0 = input()
n1 = n0.replace('1','i')
n2 = n1.replace('9','j')
n3 = n2.replace('i','9')
print(n3.replace('j','1'))

Submission status: Accepted

Solution code:
n = str(input())
p = [10 - int(i) for i in n]
print(''.join(map(str,p)))

Submission status: Accepted

Solution code:
S  = list(input())

ans = []

for item in S:
  if item == "1":
    ans.append("9")
  elif item == "9":
    ans.append("1")
    
ans = "".join(ans)
print(ans)

Submission status: Accepted

Solution code:
#111 AtCoder Beginner Contest 999

n = [_ for _ in input().rstrip()]

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

print("".join(n))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = str(input())
N=N.replace('1','l')
N=N.replace('9','q')
N=N.replace('l','9')
N=N.replace('q','1')
print(N)

Submission status: Accepted

Solution code:
n = str(input())
n = n.replace("1","o")
n = n.replace("9","n")
n = n.replace("n","1")
n = n.replace("o","9")
print(int(n))

Submission status: Accepted

Solution code:
n=str(input())
x=0
if n[0]=='1':
	x=x+900
elif n[0]=='9':
	x=x+100

if n[1]=='1':
	x=x+90
elif n[1]=='9':
	x=x+10

if n[2]=='1':
	x=x+9
elif n[2]=='9':
	x=x+1
print(x)

Submission status: Accepted

Solution code:
n=input()
n = list(n)
for i in range(len(n)):
    if int(n[i])==1:
        n[i]=9
    elif int(n[i])==9:
        n[i]=1

print(*n,sep="")

Submission status: Accepted

Solution code:
n=list(input())
for i in range(len(n)):
    if n[i]=='1':
        n[i]='9'
    elif n[i]=='9':
        n[i]='1'
print(n[0]+n[1]+n[2])

Submission status: Accepted

Solution code:
n = int(input())
m = n
for i in range(3):
    if m % 10 == 1:
        n += 8 * (10**i)
    elif m % 10 == 9:
        n += -8 * (10**i)
    m = m//10
print(n)

Submission status: Accepted

Solution code:
a=input()
b1,b2,b3=0,0,0
if a[0]=='9':
    b1='1'
else:
    b1='9'
if a[1]=='9':
    b2='1'
else:
    b2='9'
if a[2]=='9':
    b3='1'
else:
    b3='9'
print(b1+b2+b3)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = list(input())
for i, n in enumerate(a):
    if n == "1":
        a[i] = 9
    else:
        a[i] = 1
l = a[0] *100 + a[1] * 10 + a[2]  
print(int(l))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
ss = input()
res = ''
for s in ss:
  if s == '1':
    res += '9'
  if s == '9':
    res += '1'
print(res)

Submission status: Accepted

Solution code:
s = input()
s = s.replace('1','A').replace('9','B')
s = s.replace('A','9').replace('B','1')
print(s)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = input()
y = x.replace('9','2')
z = y.replace('1','9')
a = z.replace('2','1')
print(a)

Submission status: Accepted

Solution code:
for i in input():
    print([1,9][i=="1"],end="")
print()

Submission status: Accepted

Solution code:

def main():


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

    print(''.join(ans))



if __name__== "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input().split()[0])
n = str(n)
n = n.replace('1', 'x')
n = n.replace('9', '1')
n = n.replace('x', '9')

print(n)

Submission status: Accepted

Solution code:
n = input()
ans = ""
for c in n:
    ans += str(10-int(c))
print(ans)

Submission status: Accepted

Solution code:
print(input().replace('1','2').replace('9','8').replace('2','9').replace('8','1'))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=input()
print(int(n.replace('9', 'a').replace('1', '9').replace('a','1')))

Submission status: Accepted

Solution code:


x = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

print("")

Submission status: Accepted

Solution code:
n = list(map(int, input()))
for i in range(3):
    print(10 - n[i], end="")

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

n = input()

# print(n)

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

def convert(char):
    if char == '1':
        return '9'
    else:
        return '1'    

a = []
for c in n:
    # print(c)
    a.append(convert(c))

# a = ['0', '0', '0']

# if n[0] == '1':
#     a[0] = '9'
# else:
#     a[0] = '1'
    
# if n[1] == '1':
#     a[1] = '9'
# else:
#     a[1] = '1'
    
# if n[2] == '1':
#     a[2] = '9'
# else:
#     a[2] = '1'

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

print("".join(a))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = list(input())
p = len(N)
for i in range(p):
    N[i] = 10 - int(N[i])

[print(i,end='') for i in N]

Submission status: Accepted

Solution code:
kazu = list(input())
for k in range(len(kazu)):
  if kazu[k] == "1":
    kazu[k] = "9"
  elif kazu[k] == "9":
    kazu[k] = "1"
print("".join(kazu))

Submission status: Accepted

Solution code:

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

a = n // 100
b = (n%100) // 10
c = n % 10

if a == 1:
    a = 9
else:
    a = 1
if b == 1:
    b = 9
else:
    b = 1
if c == 1:
    c = 9
else:
    c = 1
    
print(a*100+b*10+c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = list(input())
new_n=["","",""]

for i in range(3):
    if n[i] == "1":
        new_n[i] = "9"
    else:
        new_n[i] = "1"

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()

out = []

for i in n:
    if i == "1":
        out += "9"
    else:
        out += "1"

print("".join(out))

Submission status: Accepted

Solution code:
s = list(input())
for i in range(len(s)):
    if s[i] == "9":
        s[i] = "1"
    elif s[i] == "1":
        s[i] = "9"
for i in s:
    print(i,end="")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=input()
n=len(x)

y=''

for i in range(n):
	if x[i]=='1':
		y=y+'9'
	else:
		y=y+'1'

print(int(y))

Submission status: Accepted

Solution code:
s=list(input())
print("".join([str(10-int(i)) for i in s]))

Submission status: Accepted

Solution code:
N = input()
S = ''
for i in range(3):
  if N[i] == '1':
    S += '9'
  elif N[i] == '9':
    S += '1'
  else:
    S += N[i]
print(S)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()

res = ""
for a in n:
    if a == "1":
        res += "9"
    else:
        res += "1"
        
print(res)

Submission status: Accepted

Solution code:
S = input()
ans = ''
for i in range(0, len(S)):
	if S[i] == '1':
		ans = ans + '9'
	if S[i] == '9':
		ans = ans + '1'
print(ans)

Submission status: Accepted

Solution code:
s = input()

ans = ""
for i in s:
    if int(i)==1 or int(i)==9:
        ans = ans + str(10-int(i))
    else:
        ans = ans + i

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    n = S()
    for i in n:
        if i == "1":
            print(9, end="")
        else:
            print(1, end="")
    print()
    return

#B
def B():
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    A()

Submission status: Accepted

Solution code:
a = input()
b = ""
for i in range(len(a)):
    b += "1" if a[i] == "9" else "9"
print(int(b))

Submission status: Accepted

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

print(''.join(ans))

Submission status: Accepted

Solution code:
n = list(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]))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
if n == 111:
    print(999)
if n == 119:
    print(991)
if n == 191:
    print(919)
if n == 199:
    print(911)
if n == 911:
    print(199)
if n == 919:
    print(191)
if n == 991:
    print(119)
if n == 999:
    print(111)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
ss = ''
for c in s:
  if c == '1':
    ss += '9'
  elif c == '9':
    ss += '1'
  else:
    ss += c
print(ss)

Submission status: Accepted

Solution code:
n=input()
n=n.replace('9','a')
n=n.replace('1','9')
n=n.replace('a','1')
print(n)

Submission status: Accepted

Solution code:
n = input()
for i in range(len(n)):
    if n[i] == '1':
        print(9, end = "")
    else :
        print(1, end = "")

Submission status: Accepted

Solution code:
n = input()
ans = ""

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

print(ans)

Submission status: Accepted

Solution code:
a = input()
b = ''
for item in a:
    if item == '1':
        b += '9'
    else:
        b += '1'

print(b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
#ABC111 A

n = list(map(str,input()))

for i in range(len(n)):
    if n[i] == "9":
        n[i] = "1"
    elif n[i] == "1":
        n[i] = "9"
print(''.join(map(str,n)))

Submission status: Accepted

Solution code:
s = input()
new_s = ''
for i in range(len(s)):
  new_s += '1' if s[i] == '9' else '9'
print(new_s)

Submission status: Accepted

Solution code:
a = input()
b = ""
for i in range(len(a)):
    if a[i] == "1":
        b += "9"
    elif a[i] == "9":
        b += "1"
print(b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
for v in s:
  if v == '9':
    print(1,end="");
  else:
    print(9,end="");

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

for s in S:
    if s == "9":
        print("1", end="")
    elif s == "1":
        print("9", end="")
print()

Submission status: Accepted

Solution code:
n=input()
N=int(n)

for i in range(3):
    if n[i]=='1':
        N+=8*(10**(2-i))
    elif n[i]=='9':
        N-=8*(10**(2-i))

print(N)

Submission status: Accepted

Solution code:
#x, y = map(int,input().split())
n = input()
mp = {'1' : '9',
      '9' : '1'}
string = [mp[i] if (i == "1" or i == "9") else i for i in n]
print("".join(string))

Submission status: Accepted

Solution code:
n=input()
print(n.translate(str.maketrans({'1':'9', '9':'1'})))
#1と9を単純に変える

Submission status: Accepted

Solution code:
n = input()
ans = []
for i in range(3):
    if n[i] == '1' or n[i] == '9':
        ans.append(str(10 - int(n[i])))
    else:
        ans.append(n[i])
print(''.join(ans))

Submission status: Accepted

Solution code:
n=input()
n=n.replace('1','0')
n=n.replace('9','1')
n=n.replace('0','9')
print(n)

Submission status: Accepted

Solution code:
n =  list(input())
x = []
for i in n:
  if i == '1':
    x.append(i.replace('1','9'))
  elif i == '9':
    x.append(i.replace('9','1'))
  else:
    x.append(i)
    
print(''.join(x))

Submission status: Accepted

Solution code:
n = input()
for c in n:
  if c == '1':
    print('9', end="")
  else:
    print('1', end="")

Submission status: Accepted

Solution code:
s = input()
ans = []
for i in list(s):
    if i == "1":
        ans.append("9")
    elif i == "9":
        ans.append("1")
    else:
        ans.append(i)

print("".join(ans))

Submission status: Accepted

Solution code:
nList = list(input())
s = ""
for elm in nList:
    s += "1" if elm == "9" else "9"
print(s)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
ans = ''
for i in s:
    if i=='1':
        ans+='9'
    elif i=='9':
        ans+='1'
print(ans)

Submission status: Accepted

Solution code:
s = list(input())

if s[0] == '1':
    s[0] = s[0].replace('1', '9')
elif s[0] == '9':
    s[0] = s[0].replace('9', '1')
if s[1] == '1':
    s[1] = s[1].replace('1', '9')
elif s[1] == '9':
    s[1] = s[1].replace('9', '1')
if s[2] == '1':
    s[2] = s[2].replace('1', '9')
elif s[2] == '9':
    s[2] = s[2].replace('9', '1')

print(''.join(s))

Submission status: Accepted

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

# input
n = input()

# solve & output
print(n.translate(str.maketrans({'1': '9', '9': '1'})))

Submission status: Accepted

Solution code:
n = input()

lst = list(n)
for i in range(3):
    if lst[i]=='9':
        lst[i]='1'
    elif lst[i]=='1':
        lst[i]='9'
    else:
        pass

n = "".join(lst)

print(n)

Submission status: Accepted

Solution code:
def main():
    s = input()
    ans = ""
    for c in s:
        if c == '1':
            ans += '9'
        elif c == '9':
            ans += '1'
        else:
            ans += c
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()
s=s.replace('1', 'one')
s=s.replace('9', 'nine')
s=s.replace('nine', '1')
s=s.replace('one', '9')
print(s)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
dictionary = {'1':'9','9':'1'}
print(''.join([dictionary[x] for x in list(input())]))

Submission status: Accepted

Solution code:
n=int(input())
d=1
for i in range(3):
    x=n//d%10
    if x==1:
        n+=8*d
    elif x==9:
        n-=8*d
    d*=10

print(n)

Submission status: Accepted

Solution code:
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

N = s()

res = ''
for c in N:
    if c == '1':
        res += '9'
    else:
        res += '1'
print(res)

Submission status: Accepted

Solution code:
n = input()
p = n.replace("9","a")
q = p.replace("1","b")
r = q.replace("a","1")
s = r.replace("b","9")

print(int(s))

Submission status: Accepted

Solution code:
n = input()
d = {'1':'9','9':'1'}

print(''.join([d[i] for i in n]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = list(input())

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

result = int("".join(n))

print(result)

Submission status: Accepted

Solution code:
n = input()
lists = []
for i in range(3):
    lists.append(n[i])
for i in range(len(n)):
    if lists[i] == "1":
        lists[i] = "9"
    else:
        lists[i] = "1"

n = "".join(lists)
print(int(n))

Submission status: Accepted

Solution code:
n = input()

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

Submission status: Accepted

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

print("".join(s))

Submission status: Accepted

Solution code:
print(input().replace("1","*").replace("9","1").replace("*","9"))