180°

AtCoder
IDabc202_b
Time2000ms
Memory256MB
Difficulty
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$ [samples]
Samples
Input #1
0601889
Output #1
6881090

Rotating `0601889` $180$ degrees results in `6881090`.
Input #2
86910
Output #2
01698
Input #3
01010
Output #3
01010

$S$ may remain the same.
API Response (JSON)
{
  "problem": {
    "name": "180°",
    "description": {
      "content": "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 strin",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc202_b"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You are given a string $S$ consisting of `0`, `1`, `6`, `8`, and `9`.\nRotate $S$ $180$ degrees and print the result. In other words, apply the following operations on $S$ and print the resulting strin...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments