I have a somewhat esoteric problem. My program wants to decode morse code.

The point is, I will need to handle *any* character. Any random characters that adhere to my system and can correspond to a letter should be accepted. Meaning, the letter "Q" is represented by "- - . -", but my program will treat any string of characters (separated by appropriate newchar signal) to be accepted as Q, for example "dj ir j kw" (long long short long).

There is a danger of falling out of sync, so I will need to implement a "new character" signal. I chose this to be "xxxx" as in 4 letters. For white, blank space symbol, I chose "xxxxxx", 6 chars.

Long story short, how can I split the string that is to be decoded into readable characters based on the *length* of the delimeter (4 continous symbols), since I can't really deterministically know *what* letters will make up the newchar delimeter?