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:
n=input()
#print(n.replace("1","9"))
x =""

for i in n:
    if i == "1":
        x += "9"
    else:
        x += "1"
print(int(x))

Submission status: Accepted

Solution code:
import math
import collections
import sys

#input = sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]

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

Submission status: Accepted

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

Submission status: Accepted

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

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("".join(n))

Submission status: Accepted

Solution code:

n = input()
ans = ""

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

Submission status: Accepted

Solution code:
n = input()

r = {'1': '9', '9': '1'}

ans = ''

for i in n:
    ans += r[i]

print(ans)

Submission status: Accepted

Solution code:
import sys
import os
import math

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    S = list(iss())
    print("".join(["1" if s == "9" else "9" for s in S]))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num = input()
lis = ""

for i in num:
    if i == "1":
        lis+="9"
    else:
        lis+="1"

print(int(lis))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def Atcoder999(n):

    return n.replace("9" , "5").replace("1" , "9").replace("5" , "1")

def main():
    n = str(input())
    print(Atcoder999(n))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = list(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = []
a = N//100
b = N//10-a*10
c = N - a*100 - b*10
A.append(a)
A.append(b)
A.append(c)
for i in range(3):
    if A[i]==1:
        A[i]=9
    elif A[i]==9:
        A[i]=1
print(A[0]*100+A[1]*10+A[2])

Submission status: Accepted

Solution code:
n = input()

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

print(out)

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:
a=input()

ans=[]

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

Submission status: Accepted

Solution code:
n = input()
new_n = ''
for c in n:
    if c == '1':
        new_n += '9'
    else:
        new_n += '1'
print(int(new_n))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = iss()
    N = N.replace('1', 'b')
    N = N.replace('9', '1')
    N = N.replace('b', '9')
    print(N)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#ABC-111-A
n = input()
ans = ""
for num in n:
    if num == "1":
        ans += "9"
    else:
        ans += "1"
        
print(int(ans))

Submission status: Accepted

Solution code:
K = int(input())
print(1110-K)

Submission status: Accepted

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

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:
n = str(input())
num = list(n)

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=input()

N=list(n)

A=[]

for i in range(3):
  if N[i]=='1':
    A.append('9')
  else:
    A.append('1')

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

Submission status: Accepted

Solution code:
n = input()

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

print(ans)

Submission status: Accepted

Solution code:
n = list(input())

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

for j in range(3):
  print(n[j], end="")

Submission status: Accepted

Solution code:
a = input()
b_dic = {'1':'9', '9':'1'}
c=''
for i in range(3):
     c+=b_dic[a[i]]
    
print(c)

Submission status: Accepted

Solution code:
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
from datetime import datetime as dt

def main():
  n = input()
  ans = ''
  for i in range(len(n)):
    if n[i]=='1':
      ans += '9'
    else:
      ans += '1'
  print(ans)
  
  
  
  
if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
# ABC 111: A – AtCoder Beginner Contest 999
n = input()
result = n.replace('1', 'a').replace('9', '1').replace('a', '9')
print(result)

Submission status: Accepted

Solution code:
def main():
  n = list(input())
  #s = input()
  #s = input().split()
  #a,b = list(map(int,input().split()))
  #a = [input() for i in range(n)]
  #a = [int(input()) for i in range(n)]
  #a = [input().split() for i in range(n)]
  #a = [list(map(int,input().split())) for i in range(n)]
  ans = 0
  count = 0
  lis = []
  
  for i in range(len(n)):
    if n[i] == "1":
      n[i] = "9"
    elif n[i] == "9":
      n[i] = "1"
  print("".join(n))

if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
n = str(input())

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

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("".join(n))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#どっちで出すか注意, rstrip注意
#提出前に見返すこと！
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    mod = 10**9 + 7

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

n = sys.stdin.readline().rstrip()

def main(n):
    n = n.replace('1', '0').replace('9', '1').replace('0', '9')
    print(n)

if __name__ ==  '__main__':
    main(n)

Submission status: Accepted

Solution code:
s = input()
print(s.replace("9","c").replace("1","9").replace("c","1"))

Submission status: Accepted

Solution code:
n=int(input())

if n//100==9:
    n-=800
else:
    n+=800

if (n%100)//10==9:
    n-=80
else:
    n+=80

if n%10==9:
    n-=8
else:
    n+=8

print(n)

Submission status: Accepted

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

Submission status: Accepted

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

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:
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

if __name__ == '__main__':
    a = input()
    ans =""
    
    for i in a:
        if i =="1":
            ans +="9"
        else:
            ans+="1"
    print(ans)

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:
n = str(input())

res = []
for i in range(len(n)):
    if n[i] == "1":
        res.append("9")
    else:
        res.append("1")

print("".join(res))

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
s = list(s)
if s[0] == '1':
  s[0] = '9'
else:
  s[0] = '1'
if s[1] == '1':
  s[1] = '9'
else:
  s[1] = '1'
if s[2] == '1':
  s[2] = '9'
else:
  s[2] = '1'

print(''.join(s))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()

answer=""

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

print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8

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

Submission status: Accepted

Solution code:
n = input()

#print(n[0] , n[1] , n[2])
answer = 0
if n[0] =="1":
	answer = answer + 900
else:
    answer = answer + 100

if n[1] =="1":
	answer = answer + 90
else:
	answer = answer + 10

if n[2] =="1":
	answer = answer + 9
else:
	answer = answer + 1

print(answer)

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *
from math import *
from fractions import *

sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()


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

main()

Submission status: Accepted

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