#P6263. Finger Typing Count
Finger Typing Count
Finger Typing Count
The art of correct typing is becoming an important part of modern culture. If you are still not using all ten fingers to type, you must relearn typing – and then you will type faster and more comfortably.
Many websites teach you proper touch typing. The diagram below shows the basic principle: keys that are meant to be pressed by the same finger have the same color. Specifically, yellow keys are pressed by the little finger, blue keys by the ring finger, green keys by the middle finger, and red keys by the index finger. Naturally, the left hand presses keys on the left side of the keyboard (i.e. those on or to the left of the keys 5, T, G, B) while the right hand presses keys on the right side (i.e. those on or to the right of the keys 6, Y, H, N). The thumbs are reserved for the space bar.
Your task is to count the number of times each finger (except the thumbs) is used to correctly type the given string.
The keyboard is assumed to be a standard QWERTY keyboard and is split as follows:
- Left hand (keys on the left side):
- Left pinky (yellow): Row1: 1; Row2: Q; Row3: A; Row4: Z
- Left ring (blue): Row1: 2; Row2: W; Row3: S; Row4: X
- Left middle (green): Row1: 3; Row2: E; Row3: D; Row4: C
- Left index (red): Row1: 4, 5; Row2: R, T; Row3: F, G; Row4: V, B
- Right hand (keys on the right side):
- Right index (red): Row1: 6; Row2: Y; Row3: H; Row4: N
- Right middle (green): Row1: 7; Row2: U; Row3: J; Row4: M
- Right ring (blue): Row1: 8; Row2: I; Row3: K; Row4: ,
- Right pinky (yellow): Row1: 9, 0; Row2: O, P; Row3: L, ; ; Row4: ., /
Note: The matching is case-insensitive for alphabetic characters. Keys not listed in the mapping (including spaces, which are pressed by the thumbs) should be ignored.
Input: A single line string representing the key presses.
Output: Eight space-separated integers representing the counts for left pinky, left ring finger, left middle finger, left index finger, right index finger, right middle finger, right ring finger, and right pinky, in that order.
inputFormat
The input consists of a single string which may contain letters, digits, punctuation and spaces. Spaces (typed by thumbs) should be ignored.
outputFormat
Print eight space-separated integers corresponding to the number of times the following fingers are used: left pinky, left ring, left middle, left index, right index, right middle, right ring, and right pinky.
sample
QAZ 1ws
4 2 0 0 0 0 0 0