The song YYZ by Rush opens with a theme based on the rhythm of “YYZ” in Morse code:

-.-- -.-- --..

YYZ is the designation for the Toronto Pearson International Airport, the main airport serving Toronto. The idea for the song came from hearing the airport identifier in Morse code.

However, the song puts no spaces between rhythm corresponding to each letter. Here’s what the opening riff would look like in sheet music:

Each dash is a middle C and each dot is an F# a tritone below middle C.

When I listen to the song, I don’t hear YYZ. My mind splits up the rhythm with each sequence of long notes starting a group:

-. ---. ----..

So I hear the 20/8 time signature as (3 + 7 + 10)/8.

In terms of Morse code, -. is N. Interpreting the other groupings depends on what you mean by Morse code. The American amateur radio community defines Morse code as 40 characters: the 26 letters of the Latin alphabet, 10 digits, and 4 more symbols: / = , . Using that definition of Morse code, there are no symbols corresponding to `---.`

or `----..`

. There is no symbol corresponding to `----`

either. More on unused sequences here.

However, sometimes `---.`

is used for Ö and `----`

for Š. So the way I hear “YYX” would be more like “NÖŠI”.

There are many other ways to parse `-.---.----..`

into Morse code symbols. For example, NO1I

-. --- .---- ..

## Enumeration

How many ways could you split `-.---.----..`

into valid Morse code?

Here’s an outline of a recursive algorithm to enumerate the possibilities.

Start at the beginning and list the possible symbols formed by consecutive dots and dashes. In our case the possible symbols are T, N, K, and Y. So the possibilities are

- T (
`-`

) added to the front of all sequences that start with`.---.----..`

- N (
`-.`

) added to the front of all sequences that start with`---.----..`

- K (
`-.-`

) added to the front of all sequences that start with`--.----..`

- Y (
`-.--`

) added to the front of all sequences that start with`-.----..`

So for the first bullet point, for example, how would we find all sequences that start with `.---.----..`

? Use the same idea.

- E (
`.`

) added to the front of all sequences that start with`---.----..`

- A (
`.-`

) added to the front of all sequences that start with`--.----..`

- W (
`.--`

) added to the front of all sequences that start with`-.----..`

- J (
`.---`

) added to the front of all sequences that start with`.----..`

So pull off all the symbols you can from the beginning of the list of dots and dashes and in each case recurse on the rest of the list.