UVA-10415 - Eb Alto Saxophone Player

  • UVa Online Judge 解題結果請於 Submit 後,參閱 uHunt
  • 如果你有任何建議與指教,歡迎於下方留言一起討論喔!
  • 本題選為「20161004 / 20101011 大學程式能力檢定 CPE」題目。

題意概要

在演奏薩克斯風時,有些曲子需要手指快速移動。假設每首曲子由某一個八度的 C、D、E、F、G、A、B 和高一個八度的 C、D、E、F、G、A、B 的音調 (note) 所組成,以 c、d、e、f、g、a、b、C、D、E、F、G、A、B 來表示。每個音調的指法如下:

c 手指 2∼4, 7∼10
d 手指 2∼4, 7∼9
e 手指 2∼4, 7, 8
f 手指 2∼4, 7
g 手指 2∼4
a 手指 2, 3
b 手指 2
C 手指 3
D 手指 1∼4, 7∼9
E 手指 1∼4, 7, 8
F 手指 1∼4, 7
G 手指 1∼4
A 手指 1∼3
B 手指 1∼2

假設每種不同的指法控制一種音調,而且一個手指頭按特定一個按鍵。所以請寫出一支程式去計算每一根手指頭按了多少次按鍵。如果某一按鍵在下一音符時不會用到,那麼就會放開,否則就是維持按著的情況。試問:每根手指總共按了幾次按鍵?


Input

The first line of the input is a single integer (), indicating the number of test cases. For each case, there is only one line containing the song. The only allowed characters are { c, d, e, f, g, a, b, C, D, E, F, G, A, B }. There are at most notes in a song, and the song maybe empty.


Output

For each test case, print numbers indicating the number of presses for each finger. Numbers are separated by a single space.


Sample Input

3
cdefgab
BAGFEDC
CbCaDCbCbCCbCbabCCbCbabae

Sample Output

0 1 1 1 0 0 1 1 1 1
1 1 1 1 0 0 1 1 1 0
1 8 10 2 0 0 2 2 1 0
profile-image
David Lu
Hello, I'm David Lu. I am a graduate student in Department of Computer Science at National Chiao Tung University, Taiwan. I am in the Networking and Sensing Systems (NSS) Lab at NCTU. If you have any question, please feel free to contact with me.
comments powered by Disqus