codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

514A.md (960B)


      1 Source: https://codeforces.com/problemset/problem/514/A
      2 
      3 A. Chewbaсca and Number
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 Luke Skywalker gave Chewbacca an integer number *x*. Chewbacca isn't good at numbers but he loves inverting digits in them. Inverting digit *t* means replacing it with digit 9 - *t*.
     22 
     23 Help Chewbacca to transform the initial number *x* to the minimum possible positive number by inverting some (possibly, zero) digits. The decimal representation of the final number shouldn't start with a zero.
     24 
     25 Input
     26 
     27 The first line contains a single integer *x* (1 ≤ *x* ≤ 1018) — the number that Luke Skywalker gave to Chewbacca.
     28 
     29 Output
     30 
     31 Print the minimum possible positive number that Chewbacca can obtain after inverting some digits. The number shouldn't contain leading zeroes.
     32 
     33 Examples
     34 
     35 Input
     36 
     37 ```
     38 27
     39 ```
     40 
     41 Output
     42 
     43 ```
     44 22
     45 ```
     46 
     47 Input
     48 
     49 ```
     50 4545
     51 ```
     52 
     53 Output
     54 
     55 ```
     56 4444
     57 ```