B - 180° Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MB

配点 : 200

問題文

01689 からなる文字列 S が与えられます。

S180 度回転したものを出力してください。すなわち、S に次の操作を施してできる文字列を出力してください。

  • S を反転する。
  • 00 に、11 に、69 に、88 に、96 に変換する。

制約

  • 1 \leq |S| \leq 10^5
  • S01689 からなる。

入力

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

S

出力

S180 度回転した文字列を出力せよ。


入力例 1

0601889

出力例 1

6881090

0601889180 度回転すると 6881090 になります。


入力例 2

86910

出力例 2

01698

入力例 3

01010

出力例 3

01010

S が変化しないこともあります。

Score : 200 points

Problem Statement

You are given a string S consisting of 0, 1, 6, 8, and 9.

Rotate S 180 degrees and print the result. In other words, apply the following operations on S and print the resulting string:

  • Reverse S.
  • Replace each 0 with a 0, each 1 with a 1, each 6 with a 9, each 8 with an 8, and each 9 with a 6.

Constraints

  • 1 \leq |S| \leq 10^5
  • S consists of 0, 1, 6, 8, and 9.

Input

Input is given from Standard Input in the following format:

S

Output

Print the result of rotating S 180 degrees.


Sample Input 1

0601889

Sample Output 1

6881090

Rotating 0601889 180 degrees results in 6881090.


Sample Input 2

86910

Sample Output 2

01698

Sample Input 3

01010

Sample Output 3

01010

S may remain the same.