|
Time |
Memory |
| Case 1 |
1 sec |
32 MB |
| Case 2 |
1 sec |
32 MB |
| Case 3 |
1 sec |
32 MB |
| Case 4 |
1 sec |
32 MB |
| Case 5 |
1 sec |
32 MB |
Description
In music, a note has a duration (for how long the note should sound). A jingle is divided into a sequence of measures, and a measure is formed by a series of notes.
The duration of a note is indicated by its shape. In this problem, we will use uppercase letters to indicate a note's duration. The duration of a measure is the sum of the durations of its notes. The duration of a measure must always be 1.
The following table lists all the available notes:
For example, there is a composition containing five measures, of which the first four have the correct duration and the last one is wrong. In the example below, each measure is surrounded with slashes and each note is represented as in the table above.
/HH/QQQQ/XXXTXTEQH/W/HW/
You are asked to write a program that determines how many measures have the right duration.
Input
A single line containing a string whose length is at least 3 characters, inclusive, representing a composition. A composition begins and ends with a slash `/'. Measures in a composition are separated by a slash `/'. Each note in a measure is represented by the corresponding uppercase letter, as described above. You may assume that each composition contains at least one measure and that each measure contains at least one note. All characters in the input will be either slashes or one of the seven uppercase letters used to represent notes, as described above.
Output
Your program must output a single line, containing a single integer, the number of measures that have the right duration. The right duration is one.
Note: there is a newline in output.
Tags