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()
ans = ''
for s in n:
    ans += str(10-int(s))
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8

n=input()

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

print(int(n))

Submission status: Accepted

Solution code:
ans = ['1' if i == '9' else '9' for i in input()]
print(ans[0] + ans[1] + ans[2])

Submission status: Accepted

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

Submission status: Accepted

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


def main():
    """Function."""
    s = str(input())
    s1, s2, s3 = "", "", ""
    if s[0] == "1":
        s1 = "9"
    else:
        s1 = "1"
    if s[1] == "1":
        s2 = "9"
    else:
        s2 = "1"
    if s[2] == "1":
        s3 = "9"
    else:
        s3 = "1"
    print(s1+s2+s3)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    n = str(raw_input())
    ans = ''
    for ch in n:
        if ch == '1':
            ans += '9'
        else:
            ans += '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 = str(input())
nn = []
for i in n:
  if i == '1':
    nn.append('9')
  else:
    nn.append('1')
print(''.join(nn))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=list(input())
p=""
for i in range(len(n)):
    n[i]=10-int(n[i])
    p+=str(n[i])
print(p)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()

for i in range(len(n)):
    t = int(n[i])
    if t == 9 :
        print(1,sep="",end="")
    else:
        print(9,sep="",end="")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
for keta_str in n:
    keta = int(keta_str)
    if keta == 1:
        keta = 9
    else:
        keta = 1

    print(keta, end='')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = list(input())
num = 0
for i in N:
    if i == "1":
        N[num] = "9"
        num +=1
        continue
    elif i == "9":
        N[num] = "1"
        num += 1
        continue
N = "".join(N)
print(N)

Submission status: Accepted

Solution code:
def abc111_a():
    n = int(input())
    return 1110 - n


print(abc111_a())

Submission status: Accepted

Solution code:

def replace(a):
	if a=="9":
		return "1"
	elif a=="1":
		return "9"
	else:
		return a
num=raw_input()
num1="".join(map(replace,num))
print(int(num1))

Submission status: Accepted

Solution code:
# 値を取得
num = int(input())
# 返す変数準備
ans = ''
# 一文字ずつリストに格納
n = list(str(num))
# 1 or 9か確かめ格納しなおす
for i in range(len(n)):
    if str(n[i]) == '1':
        (n[i]) = '9'
    elif str(n[i]) == '9':
        (n[i]) = '1'
    ans += n[i]
# 回答の出力
print(ans)

Submission status: Accepted

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

s_in = lambda: stdin.readline()[:-1]  # s = s_in()


def replace_digits(x):
    if x == '1':
        return '9'
    else:
        return '1'

n = s_in()
ans = ''
for x in list(n):
    ans += replace_digits(x)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    S = input()
    ans = "".join(["9" if s == "1" else "1" for s in S])
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input().strip()
for i in s:
    if i == '1':
        print(9,end="")
    elif i == '9':
        print(1,end = "")
    else:
        print(i,end= "")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = list(input())

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

print(ans)

Submission status: Accepted

Solution code:
def main():
    n = input()

    ans = ""
    for d in n:
        if d == "1":
            ans += "9"
        elif d == "9":
            ans += "1"
        else:
            ans += d
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    n = input()
    l = str(n)
    
    ans = ""
    for m in l:
        if m == "1":
            ans += "9"
        elif m == "9":
            ans += "1"
        else:
            ans += m
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# https://beta.atcoder.jp/contests/abc111/tasks/abc111_a
def solve():
    print(str(input()).translate(str.maketrans({'1': '9', '9': '1'})))


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
# https://beta.atcoder.jp/contests/abc111/tasks/abc111_a
def solve():
    anstr = ""
    s = input()
    for ch in s:
        if ch is '1':
            anstr += '9'
        elif ch is '9':
            anstr += '1'
        else:
            anstr += ch
    print(anstr)


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=input()

a=list(a)

#a=[int(i) for i in a]

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

print(s)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
m = {'1': '9', '9': '1'}
n = int(input())
for i in str(n):
    print(m[i], end='')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = list(map(int, input()))

for i in range(len(n)):
    n[i] = 10 - n[i]
    n[i] = str(n[i])

a = "".join(n)
print(a)

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:
print(str(input()).replace("1", "0").replace("9", "1").replace("0", "9"))

Submission status: Accepted

Solution code:
char = input()
chars = list(char)

for cha in chars:
  if cha == "1":
    cha = "9"
  elif cha == "9":
    cha = "1"
  print(cha, end="")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# あ
N = list(input())

out_str = ""
for i in range(len(N)) :
	if (N[i] == "1") :
		out_str += "9"
	else :
		out_str += "1"

print(out_str)

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**13
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-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 S(): return input()
def pf(s): return print(s, flush=True)


def main():
    s = S()
    t = s.replace('9', '2').replace('1', '9').replace('2', '1')

    return t


print(main())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = str(input())
ne = n.replace('1', '&')
new = ne.replace('9', '1')
newn = new.replace('&', '9')
print(newn)

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


# aとbの最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


# aとbの最小公倍数
def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def main():
    n = input()
    ans = ""
    for c in n:
        if c == "1":
            ans += "9"
        if c == "9":
            ans += "1"
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = input()
m = list(n)
r = []

for i in range(3):
    if m[i] == "1":
        m[i] = "9"
        r.append(m[i])
    elif m[i] == "9":
        m[i] ="1"
        r.append(m[i])
    else:
        r.append(m[i])

print(int("".join(r)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input().rstrip()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import math
# count=int(input())
# nums=[int(i) for i in input().split()]
str = input()
ans = ""
for i in range(0,3,1):
    if str[i]=="1":
        ans+="9"
    elif str[i]=="9":
        ans+="1"
print(ans)

Submission status: Accepted

Solution code:
n=int(input())

a=n//100
n=n-a*100

if a==1:
	a=9
elif a==9:
	a=1

b=n//10
n=n-b*10

if b==1:
	b=9
elif b==9:
	b=1
	
if n==1:
	n=9
elif n==9:
	n=1

ans=a*100+b*10+n

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()

ans = ''
for i, v in enumerate(n):
    if v == '9':
        ans += '1'
    elif v == '1':
        ans += '9'
    else:
        ans += v

print(ans)

Submission status: Accepted

Solution code:
import sys


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


main()

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:
s = input()
for c in s:
  if c == '1': print('9', end='')
  elif c == '9': print('1', end='')

print()

Submission status: Accepted

Solution code:
'''
問題文
	猫のすぬけは文字を書く練習をしています。 すぬけは今日、数字の 1 と 9 を書く練習をしていたのですが、 間違えて 1 と 9 をあべこべに書いてしまいました。
	すぬけが書いた 3 桁の整数 n が与えられます。 
	n に含まれる 1 という桁をそれぞれ 9 に、 9 という桁をそれぞれ 1 に置き換えて得られる整数を出力してください。

制約
	111 ≤ n ≤ 999
	n は各桁が 1 か 9 である整数

入力
	入力は以下の形式で標準入力から与えられる。
	n

出力
	n の各桁の 1 と 9 を入れ替えた整数を出力してください。

入力例 1 
	119
出力例 1 
	991
	一の位の 9 を 1 に、十の位の 1 を 9 に、百の位の 1 を 9 に書き換えた 991 が答えとなります．

入力例 2 
	999
出力例 2 
	111
'''

def main():
	'''
	メイン関数
	'''
	# 入力を取得
	input_num = input()
	
	# 1と9を入れ替えて出力
	input_num = input_num.replace('1','-')
	input_num = input_num.replace('9','1')
	input_num = input_num.replace('-','9')
	print(input_num)



if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:
n=int(input())
if(n//100==9):
    n-=800
else:
    n+=800
if((n//10)%10==9):
    n-=80
else:
    n+=80
if(n%10==9):
    n-=8
else:
    n+=8


print(n)

Submission status: Accepted

Solution code:
n=str(input())
a=n.replace("1","2")
b=a.replace("9","3")
c=b.replace("2","9")
n=c.replace("3","1")
print(n)

Submission status: Accepted

Solution code:
n=input()
m=0
for i in range(3):

    if n[2-i]=="1":
        m+=9*(10**i)

    elif n[2-i]=="9":
        m+=1*(10**i)
    
    else:
        m+=int(n[2-i])*(10**i)
print(m)

Submission status: Accepted

Solution code:
str_input = input()

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

print(str_input)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=input()
b=a.replace("1","2")
c=b.replace("9","8")
d=c.replace("2","9")
e=d.replace("8","1")
print(e)

Submission status: Accepted

Solution code:
N=input().strip()
a=''

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

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()
j = [int(x) for x in list(str(n))]
for i in range(3):
    if j[i] == 1:
        j[i] = 9
    else:
        j[i] = 1

print(str(j[0]) + str(j[1]) + str(j[2]))

Submission status: Accepted

Solution code:
N=input()

result=''
for i in range(len(N)):
    if(N[i]=='1'):
        result+='9'
    elif(N[i]=='9'):
        result+='1'
    else:
        result+=N[i]
print (result)
#pythonは直接文字列を書き換えるのが難しいので、、、別の文字列を用意

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
ans = []
for index in range(3):
    ans.append('9' if '1' == n[index] else '1')
print("{n0}{n1}{n2}".format(n0=ans[0], n1=ans[1], n2=ans[2]))

Submission status: Accepted

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

n2 = int(n2)
print(n2)

Submission status: Accepted

Solution code:

s = list(input())
for j,i in enumerate(s):
    if i == '1':
        s[j] = '9'
    elif i == '9':
        s[j] = '1'


print(''.join(s))

Submission status: Accepted

Solution code:
n = list(map(int, input()))
ans = 0
x = 100
for i in range(len(n)):
    if i == 1:
        x = 10
    if i == 2:
        x = 1
    if n[i] == 9:
        ans += x * 1
    elif n[i] == 1:
        ans += x * 9
else:
    print(ans)

Submission status: Accepted

Solution code:
n_list = list(input())

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

print(''.join(n_list))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
result = []
# もしnの1桁目が"1"だったら"9"にする
if n[0] == "1":
    result.append("9")
else :
    result.append("1")    
# もしnの2桁目が"1"だったら"9"にする
if n[1] == "1":
    result.append("9")
else :
    result.append("1")    
# もしnの3桁目が"1"だったら"9"にする
if n[2] == "1":
    result.append("9")
else :
    result.append("1") 
print("{}{}{}".format(result[0],result[1],result[2]))

Submission status: Accepted

Solution code:
n = list(map(int,list(input())))
a = []

for i, code in enumerate(n):
    if code == 1:
        code = 9
        
    elif code == 9:
        code = 1

    a = a + [code]
    
a = list(map(str,a))
b = "".join(a)
print(b)

Submission status: Accepted

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

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(''.join(N))

Submission status: Accepted

Solution code:
n = raw_input()
print int(len(n)*"1"+"0") - int(n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
arr=[]
arr19=['1','9']
n=int(input())
if(n>=111 and n<=999):
    arr=list(str(n))
output=""
for i in range(3):
    if arr[i] in arr19 :
        output+=str(10-int(arr[i]))
print(output)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
print(*map("0923456781".index, input()),sep='')

Submission status: Accepted

Solution code:
N=int(input())
n=list(map(int,str(N)))
for i in range(3):
    if n[i]==1:
        n[i]=9
    elif n[i]==9:
        n[i]=1
print(n[0]*100+n[1]*10+n[2])

Submission status: Accepted

Solution code:
# abc_111_a

def transform (bango):
    if bango == "1":
        return "9"
    elif bango == "9":
        return "1"
    else:
        return bango

def solve(string):
    return "".join(list(map(transform, string)))

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

Submission status: Accepted

Solution code:
import math as M
n=input()
answer=0
for i in range(3):
    if n[i]=='9':
        answer+=10**(2-i)
    else:
        answer+=9*10**(2-i)
print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
i = str(raw_input())
print i.replace('9', 'n').replace('1', '9').replace('n', '1')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num = int(input())
num = [int(c) for c in list(str(num))]
num[0] = 10-num[0]
num[1] = 10-num[1]
num[2] = 10-num[2]
print(num[0],end="")
print(num[1],end="")
print(num[2])

Submission status: Accepted

Solution code:
num = []
n = input()

while n!= 0:
  num.append(n%10)
  n /= 10
num.reverse()

#print(num)

for i in range(len(num)):
  if num[i] == 1:
    num[i] = 9
  elif num[i] == 9:
    num[i] = 1
#print(num)

ans = ""
for j in range(len(num)):
  ans += str(num[j])
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = str(input())

result = n.replace('1', '2').replace('9','1').replace('2','9')

print(result)

Submission status: Accepted

Solution code:
number = input()
result = number.replace('1', 'hoge').replace('9', '1').replace('hoge', '9')
print(result)

Submission status: Accepted

Solution code:
number = input()

number_list = []

for i in number:
	if i == '1':
		number_list.append(9)
	else:
		number_list.append(1)


result = ''.join([str(x) for x in number_list])

print(result)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
s = str(input())
s = s.replace("1", "a").replace("9", "1").replace("a", "9")
print(s)

Submission status: Accepted

Solution code:
n = input()
length = len(n)
n_list = list(n)
ans = ''

for i in range(length):
    if n_list[i] == '1':
        n_list[i] = '9'
    elif n_list[i] == '9':
        n_list[i] = '1'
    ans+=n_list[i]

print(ans)

Submission status: Accepted

Solution code:
def chg(n):
  if n==1:
    return 9
  elif n==9:
    return 1
  return n

n = int(input())
n,a1 = divmod(n,10)
n,a2 = divmod(n,10)
n,a3 = divmod(n,10)


print(100*chg(a3)+10*chg(a2)+chg(a1))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding:utf-8


def main():
    s = str(input())

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = list(input())
N = ["a" if num == "1" else num for num in N]
N = ["1" if num == "9" else num for num in N]
N = ["9" if num == "a" else num for num in N]
N = "".join(map(str, N))

print(int(N))

Submission status: Accepted

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

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:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
s  = input()
print(s.replace("1","0").replace("9","1").replace("0","9"))

Submission status: Accepted

Solution code:
n = input()

# a は仮文字
n = n.replace("1","a")
n = n.replace("9","1")
n = n.replace("a","9")

print(int(n))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def solve(n):
    res = ""
    while n > 0:
        res = ("9" if (n % 10 == 1) else "1") + res
        n /= 10
    return res

assert solve(119) == "991"
assert solve(999) == "111"
print solve(input())

Submission status: Accepted

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

n = input()

n = n.replace('1','a')
n = n.replace('9','b')
n = n.replace('a','9')
n = n.replace('b','1')

print(n)

Submission status: Accepted

Solution code:
a = int(input())
print(111+999-a)

Submission status: Accepted

Solution code:
print(999+111-int(input()))

Submission status: Accepted

Solution code:
n = list(input())
if n[0] == "1":
  ans = "9"
else:
  ans = "1"
if n[1] == "1":
  ans = ans + "9"
else:
  ans = ans + "1"
if n[2] == "1":
  ans = ans + "9"
else:
  ans = ans + "1"
  
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

Solution code:
n = int(input())

num_li = []
for i in range(3):
    tmp = n % 10
    n = n // 10
    if tmp == 1:
        num_li.append(9)
    else:
        num_li.append(1)

multi = 1
n = 0
for i in range(len(num_li)):
    n = n + num_li[i] * multi
    multi *= 10

print(n)

Submission status: Accepted

Solution code:
n = int(input())
n1 = n//100
n2 = n//10 - n1*10
n3 = n - n1*100 -n2*10

if n1 == 1:
    m1 = 9
if n1 == 9:
    m1 = 1
if n2 == 1:
    m2 = 9
if n2 == 9:
    m2 = 1
if n3 == 1:
    m3 = 9
if n3 == 9:
    m3 = 1

print(m1*100 + m2*10 + m3)

Submission status: Accepted

Solution code:
a=list(map(int,input()))
#print(a)
b=[]
for i in range(3):
	if a[i]==1:
		b.append(str(9))
	else:
		b.append(str(1))
#print(b)
print(''.join(b))

Submission status: Accepted

Solution code:
#!/bin/env 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()

Submission status: Accepted

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

Submission status: Accepted

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

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
# }}}

# pre-defined{{{
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)]  # can also use string module
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()
# vim: set foldmethod=marker:}}}

Submission status: Accepted

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

Submission status: Accepted

Solution code:
print 1110 - input()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# AtCoder Beginner Contest 999
print(input().replace('1', '2').replace('9', '1').replace('2', '9'))