Drum pattern rolls
Your task
A drum machine stores a pattern as a non-empty string of digits, one digit per pad hit. When two identical digits sit next to each other, a performer may either play them as two separate hits or merge them into a single roll. Different digits can never merge, and a roll always covers exactly two characters. Return the number of distinct ways to perform the whole pattern. For example, "112" can be played as 1|1|2 or as 11|2, so the answer is 2.
Examples
count_drum_plays(pattern: str) -> intExample 1
Input
count_drum_plays("112")Output
2Example 2
Input
count_drum_plays("1111")Output
5