Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 200 点
問題文
0
、1
、6
、8
、9
からなる文字列 S が与えられます。
S を 180 度回転したものを出力してください。すなわち、S に次の操作を施してできる文字列を出力してください。
- S を反転する。
0
を0
に、1
を1
に、6
を9
に、8
を8
に、9
を6
に変換する。
制約
- 1 \leq |S| \leq 10^5
- S は
0
、1
、6
、8
、9
からなる。
入力
入力は以下の形式で標準入力から与えられる。
S
出力
S を 180 度回転した文字列を出力せよ。
入力例 1
0601889
出力例 1
6881090
0601889
を 180 度回転すると 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 a0
, each1
with a1
, each6
with a9
, each8
with an8
, and each9
with a6
.
Constraints
- 1 \leq |S| \leq 10^5
- S consists of
0
,1
,6
,8
, and9
.
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.