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()
n=n.replace('1','2')
n=n.replace('9','1')
n=n.replace('2','9')
print(n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-
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()

Submission status: Accepted

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

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 i in n:
    if i == "1":
        ans = ans + "9"
    else:
        ans = ans + "1"
print(int(ans))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(strN)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(int(new_n))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(j)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()
#N=119
list_N  = list(str((N)))
#list_N = list(map(int,list_N))
#print(list_N)
#swap_N = map(lambda i: i=1 if i == 9 else i=9, list_N)

#for i in list_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)))

Submission status: Accepted

Solution code:
n = input()

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

print("".join(out))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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 = 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)))

Submission status: Accepted

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

print(a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

m = 1110 - n

print(m
)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

# 関数 solve は，もちろん，問題に応じて書き換える
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()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

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)

Submission status: Accepted

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

print(t)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding:utf-8


a = int(raw_input())
#print a

a1 = a/100 #100の位
a = a%100
a2 = a/10  #10の位
a = a%10
a3 = a     #1の位

# print a
# print a1
# print a2
# print a3


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
# print a1
# print a2
# print a3

Submission status: Accepted

Solution code:

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(p-n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()

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

	print(c,end="")

print()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = input()
# print(a[0])

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

print(r)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num_list = list(map(int,input()))
#119
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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
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))


# Binary converter
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


# Width First Search (+ Distance)
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


# Depth First Search (+Distance)
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()

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

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()
ans = ''
for x in n:
  if x == '1':
    ans += '9'
  else:
    ans += '1'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

# 関数 solve は，もちろん，問題に応じて書き換える
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()

Submission status: Accepted

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

Submission status: Accepted

Solution code:

x = input()

xx  = ""

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

print(xx)

Submission status: Accepted

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

Submission status: Accepted

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

print ans

Submission status: Accepted

Solution code:
n=int(input())

print(1110-n)

Submission status: Accepted

Solution code:
N = int(input())

result = 1110 - N

print(result)

Submission status: Accepted

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

print(t)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()

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

print(Ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8

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="")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def answer(in0):

    result = ''

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

    return result


print(answer(input()))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#abc111a

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

Submission status: Accepted

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

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

print(int(m))

Submission status: Accepted

Solution code:
# A
n = input()

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

Submission status: Accepted

Solution code:
n = input()

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from sys import stdin

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

print(111 + 999 - a)

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

print(S)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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"

print(ans)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = list(input())

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

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