#P8402. Harp Tuning Commands

    ID: 21579 Type: Default 1000ms 256MiB

Harp Tuning Commands

Harp Tuning Commands

You are given a single line string representing multiple tuning instructions for a harp. Each instruction is composed of a sequence of uppercase letters representing the strings, followed by an operator and a number. The operator can be either + (representing tighten) or - (representing loosen). For example, the instruction AFB+8HC-4 is actually two tuning commands:

  • $AFB+8$ means that strings A, F, B should be tightened by 8 turns.
  • $HC-4$ means that strings H, C should be loosened by 4 turns.

Your task is to parse the given tuning command string and reformat it so that each command is printed on a new line with the format:

<STRING_GROUP> <ACTION> <NUMBER>

where <ACTION> is tighten if the operator is + and loosen if the operator is -.

inputFormat

The input consists of a single line string that contains the tuning commands.

Example: AFB+8HC-4

outputFormat

For each command in the input, output a separate line in the format:

  

Example:

AFB tighten 8
HC loosen 4

sample

AFB+8HC-4
AFB tighten 8

HC loosen 4

</p>