102021: [AtCoder]ABC202 B - 180°

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

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.

Input

题意翻译

给出由 `0`,`1`,`6`,`8`,`9` 组成的字符串 $S$。 把 $S$ 旋转 $180$ 度并输出。换句话说: - 翻转 $S$。 - 将 `0` 变成 `0`,`1` 变成 `1`,`6` 变成 `9`,`8` 变成 `8`,`9` 变成 `6`。

加入题单

算法标签: