QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 64 MB Puntuación total: 100

#12572. Stick Game

Estadísticas

This is a very old game. You are given an incorrect equation formed by matchsticks on a table. You must move exactly one matchstick to make the equation correct. Now it is your turn.

Task

Read an equation from a file (the equation is guaranteed to be incorrect). If moving one matchstick can make the equation correct, output the new equation; otherwise, output No.

Constraints

  1. The numbers in the equation can be positive or negative. The only operators are addition and subtraction, and there is exactly one equals sign. There are no parentheses, multiplication, or division operators, and no sequences like ++, --, +-, or -+.
  2. The equation will not contain 8 or more consecutive digits (the absolute value of the numbers is less than or equal to 9999999).
  3. You can only move matchsticks that form the digits; you cannot move the matchsticks that form the operators (+, -, =). Therefore, the plus signs, minus signs, and equals signs will not change. Before and after the move, the digits formed by the matchsticks must strictly correspond to the digits 0-9 as shown in Figure 2.
  4. The numbers in the equation read from the file will not start with 0, but numbers in the equation after the modification are allowed to start with 0.

Input

Read a string from the file game.in. The string contains an equation ending with a # character (ASCII 35). There are no spaces or other separators in the equation. The input data strictly follows the logic. The length of the string is less than or equal to 1000.

Note: There may be some characters irrelevant to the problem after the # character.

Output

Store the result in the file game.out. Output only one line. If there is a solution, output the correct equation in the same format as the input (ending with #, with no separators in between, and no extra characters). The input data guarantees that the solution is unique. If there is no solution, output No.

Examples

Input 1

1+1=3#

Output 1

1+1=2#

Input 2

1+1=3+5#

Output 2

No

Input 3

11+77=34#

Output 3

17+17=34#

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.