#TCTM5806. Harp Tuning
0
Harp Tuning
Harp Tuning
题目描述
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. 现在有一个竖琴,像其他乐器一样,它可以走调。 一个有音乐倾向的计算机科学学生写了一个聪明的计算机程序来帮助竖琴调音。 这个程序程序分析了竖琴产生的声音,并提供指令来修复每根失调的弦。 每条指令包括一组琴弦,它们是应该收紧还是松开,以及转多少圈。 例如,单行的 实际上包含两条调谐指令。 和 。 第一条指令表示竖琴的 弦应收紧 圈。 第二条指令表示,竖琴的 弦应该松开 圈。 你的工作是把单行的调音指令,变得更容易阅读。
输入格式
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.  一行,输入一个字符串 $s$。输出格式
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;最后输出转数 (用空格间隔开)。
AFB+8HC-4
AFB tighten 8
HC loosen 4
AFB+8SC-4H-2GDPE+9
AFB tighten 8
SC loosen 4
H loosen 2
GDPE tighten 9
提示
#### 数据范围与提示 对于全部数据:$1\le s\le 1000,1\le x\le 99999$样例解释
Explanation of Sample Output 1 The input contains two tuning instructions: AFB+8 and HC-4. Explanation of Sample Output 2 The input contains four tuning instructions: AFB+8, SC-4, H-2, and GDPE+9.