P7106 Dual Monologue

Background

I like quietness, you love noise; I stay loyal to warmth, you are crazy about coolness. If everything has an opposite, then what about the colors that piece this world together? Is it only white and black?

Description

To formally describe colors, we introduce the **RGB color value**, using a triple $(r,g,b)$ to represent a color, where $r,g,b$ are the **R value**, **G value**, and **B value** of the color, respectively. They satisfy $0 \le r,g,b \le 255$ and are all **decimal integers**. Obviously, this color system can represent $256 \times 256 \times 256 = 16\,777\,216$ different colors in total. For a color $(r,g,b)$, define its **inverse color** RGB value as $(255-r,255-g,255-b)$. However, people found that using RGB values directly is inconvenient, because copying a color requires copying three values. So the **hex color code** was created, which is a string of length $7$ like `#EBA932`. Specifically: - The first character of the string is `#`, which is the color code identifier. - The second and third characters are hexadecimal digits. The hexadecimal number formed by them equals the R value of the color in decimal. - The fourth and fifth characters are hexadecimal digits. The hexadecimal number formed by them equals the G value of the color in decimal. - The sixth and seventh characters are hexadecimal digits. The hexadecimal number formed by them equals the B value of the color in decimal. Hexadecimal digits, from small to large, include `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `A`, `B`, `C`, `D`, `E`, `F`. Note that `A`, `B`, `C`, `D`, `E`, `F` must all be **uppercase**. Now you are given a hex color code. Please output the hex color code of its inverse color. *Hint: The RGB value of a color and its hex code can be converted to each other (see sample explanation #2).*

Input Format

One line: a string of length $7$, representing the hex color code of the original color.

Output Format

One line: a string of length $7$, representing the hex color code of the inverse color.

Explanation/Hint

**[Sample Explanation #1]** After conversion, the RGB value of the original color is $(255,255,255)$, and the RGB value of the inverse color is $(0,0,0)$, which corresponds to the hex code `#000000`. **[Sample Explanation #2]** After conversion, the RGB value of the original color is $(235,169,50)$, and the RGB value of the inverse color is $(20,86,205)$, which corresponds to the hex code `#1456CD`. To avoid misunderstanding, here is a special explanation of why the B value after converting `#EBA932` is $50$: take the sixth and seventh characters of the string to form the hexadecimal number $(32)_{16}$, then $(32)_{16} = 3 \times 16^1 + 2 \times 16^0 = 50$. ---- **[Constraints]** This problem has 10 test points. For each test point you pass, you can get 10 points. For $10\%$ of the testdata, it is sample #1. For another $30\%$ of the testdata, neither the input string nor the output string contains uppercase letters. For all testdata, it is guaranteed that the given string is a valid hex color code. Translated by ChatGPT 5