a913: Harp Tuning
Tags :
Accepted rate : 14人/20人 ( 70% ) [非即時]
評分方式:
Tolerant

最近更新 : 2022-12-17 11:06

Content

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

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.

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.

Sample Input #1
AFB+8HC-4
Sample Output #1
AFB tighten 8 HC loosen 4
Sample Input #2
AFB+8SC-4H-2GDPE+9
Sample Output #2
AFB tighten 8 SC loosen 4 H loosen 2 GDPE tighten 9
測資資訊:
記憶體限制: 64 MB
公開 測資點#0 (16%): 1.0s , <1K
公開 測資點#1 (16%): 1.0s , <1K
公開 測資點#2 (17%): 1.0s , <1K
公開 測資點#3 (17%): 1.0s , <1K
公開 測資點#4 (17%): 1.0s , <1K
公開 測資點#5 (17%): 1.0s , <1K
Hint :
Tags:
出處:
[管理者:
issin@g.puic... (冼一心老師)
]


ID User Problem Subject Hit Post Date
沒有發現任何「解題報告」