P2702 [NOI2003] Matchstick Game

Background

Luogu does not support file input and output. Please read from standard input (stdin) and write to standard output (stdout). -------- This is a very old game. Using matchsticks, an incorrect equation is arranged on the table. Move, and only move, exactly one matchstick to make the equation correct. Now it is your turn.

Description

Read an expression from input (the expression is guaranteed to be an incorrect equation). If moving exactly one matchstick can make the equation correct, output the new equation; otherwise, output `No`. Notes and constraints: 1. Numbers in the expression can be positive or negative. The only operators are plus and minus, and there is exactly one equals sign. There are no parentheses, multiplication, or division, and sequences like `++`, `--`, `+-`, or `-+` will not appear. 2. There will not be $8$ or more consecutive digits in the expression (the absolute value of any number is at most $9999999$). 3. You may only move matchsticks that form digits; you cannot move the matchsticks that form the operators (`+`, `-`, `=`), so the plus sign, minus sign, and equals sign never change. Before and after the move, the digit shapes must strictly match the patterns for $0\sim9$ shown in Figure 2. 4. Numbers in the input expression will not start with $0$, but numbers in the corrected equation are allowed to start with the digit $0$.

Input Format

Read one line from standard input. The line contains an expression that ends with the `#` character (ASCII code 35). There are no spaces or other separators. The input strictly follows the logical specification. The string length is less than or equal to $1000$. Note: There may be some characters after the `#` character that are unrelated to the problem.

Output Format

Write exactly one line to standard output. If there is a solution, output the corrected equation in the same format as the input (ending with `#`, with no separators and no extra characters). In this case, the input guarantees the solution is unique. If there is no solution, output `No` (uppercase `N`, lowercase `o`).

Explanation/Hint

Translated by ChatGPT 5