2385: Harp Tuning

Memory Limit:128 MB Time Limit:1.000 S
Creator:
Submit:14 Solved:2

Description

The CCC harp is a stringed instrument with strings labelled A, B, . . . , T. Like other instruments, it can be out of tune. 
A musically inclined computer science student has written a clever computer program to help tune the harp. The program analyzes the sounds produced by the harp and provides instructions to fix each string that is out of tune. Each instruction includes a group of strings, whether they should be tightened or loosened, and by how many turns. 
Unfortunately, the output of the program is not very user friendly. It outputs all the tuning instructions on a single line. For example, the single line AFB+8HC-4 actually contains two tuning instructions: AFB+8 and HC-4. The first instruction indicates that harp strings A, F, and B should be tightened 8 turns, and the second instruction indicates that harp strings H and C should be loosened 4 turns. 
Your job is to take a single line of tuning instructions and make them easier to read.

CCC竖琴是一种弦乐器,其弦由 A、B、...、T 标记。和其他乐器一样,它可能会走音。一位音乐天赋的计算机科学学生编写了一个聪明的计算机程序来帮助调音。该程序分析竖琴发出的声音,并提供指导来修正每根走音的弦。每个指令包括一组弦、应该是加紧还是放松,以及转动的次数。
不幸的是,该程序的输出并不是非常用户友好。它将所有的调音指令输出在一行上。例如,单行 AFB+8HC-4 实际上包含两个调音指令:AFB+8 和 HC-4。第一个指令表示竖琴的 A、F 和 B 弦应该加紧 8 转,第二个指令表示 H 和 C 弦应该放松 4 转。你的任务是将一行调音指令变得更易于阅读。

Input

There will be one line of input which is a sequence of tuning instructions. Each tuning instruction will be a sequence of uppercase letters, followed by a plus sign (+) or minus sign (-), followed by a positive integer. There will be at least one instruction and at least one letter per instruction. Also, each uppercase letter will appear at most once. 
The following table shows how the available 15 marks are distributed.

输入将是一行调音指令的序列。每个调音指令将是一系列大写字母,后面跟着加号(+)或减号(-),再跟着一个正整数。至少会有一个指令和每个指令至少有一个字母。另外,每个大写字母最多出现一次。下表显示了可获得的 15 分如何分配。

Output

There will be one line of output for each tuning instruction. Each line of output will consist of three parts, each separated by a single space: the uppercase letters referring to the strings, tighten if the instruction contained a plus sign or loosen if the instruction contained a minus sign, and the number of turns.
每个调音指令将有一行输出。每行输出将由三部分组成,每部分之间用一个空格隔开:指代弦的大写字母、如果指令包含加号则为 tighten,如果指令包含减号则为 loosen,以及转动的次数。

Sample Input

AFB+8SC-4H-2GDPE+9

Sample Output

AFB tighten 8
SC loosen 4
H loosen 2
GDPE tighten 9

HINT

The input contains four tuning instructions: AFB+8, SC-4, H-2, and GDPE+9.
输入包含四条调音指令:AFB+8、SC-4、H-2 和 GDPE+9。

Source/Category