The Adventure of Morse Code

Problem #277

Tags: simple c-1 strings ascii cryptography

Who solved this?

No translations... yet
Sherlock Holmes and Dr. Watson from soviet movie

This problem was kindly provided - text and code - by Vladimir V. Zelevinsky - thanks a lot!

"What do you think of this telegram, Watson?" Holmes asked me one morning.

I glanced at the piece of paper he handed me.

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

"Looks like Morse code," I said.

"Your mental alacrity never ceases to amaze me," said Holmes dryly. "I was inquiring, however, after its meaning."

"I was in the medical corps, not in communications," I started, but Holmes interrupted.

"I do not expect you to know Morse code by heart," he said. "I have, however, recently published a monograph on the 831 most common coding systems. Here is the relevant page."

The book he handed to me contained the following table.

a   .-
b   -...
c   -.-.
d   -..
e   .
f   ..-.
g   --.
h   ....
i   ..
j   .---
k   -.-
l   .-..
m   --
n   -.
o   ---
p   .--.
q   --.-
r   .-.
s   ...
t   -
u   ..-
v   ...-
w   .--
x   -..-
y   -.--
z   --..

"Then," I said, "it's a simple matter of decoding."

"I do concur," said Holmes, "that at the first glance the problem appears easy."

"Let's see," I said. "This starts with two dashes. So that's an 'm'."

"Or, possibly," interjected Holmes, "the start of a 'g'. Or of a 'q'. Or a 't', followed by something else."

I stared at the telegram. "Wait," I said, "this has no breaks between the letters."

"If you had spent as much time as I did studying the professional habits of British telegraph operators," said Holmes, "you would know they, as a rule, do not insert breaks between the letters and are well-trained enough to understand the transmission as an uninterrupted stream."

I must have looked entirely lost, because Holmes took pity on me.

"I happen to know," he said, "that this is Moriarty's passcode. He never misses a chance to demonstrate his disdain of me and always uses for his passcodes the contiguous sequences of between ten and thirteen words, inclusively, from your first book. Don't ask how I obtained this knowledge. My memories of having to disguise myself as a telegram girl are too painful yet."

"My first book?" I asked, dazed.

"Yes," said Holmes, "A Study in Scarlet. He uses the text that is lowercased, stripped of all punctuation, and concatenated into a single line. As a matter of fact, here it is, for your convenience: A Study in Scarlet. I obtained this via hacking into Moriarty's calculation engine."

"How does one hack into a calculation engine?" I asked.

Holmes raised an eyebrow at me. "How does one hack into anything?" he said. "With an axe, of course."

I stared at the file.

"But," I started, "to analyze the letters' relative frequencies and all possible breaks in the code would take..."

"As I said," interrupted Holmes, "at the first glance, the problem appears easy. At the second glance, it's elementary, Watson. Here's the encoded text."

may be very clever i said to myself but he is certainly

"How did you determine that?!" I exclaimed.

"This," said Holmes, "is indeed the problem. How did I? Maybe you could use your calculation engine and apply my deductive method to the other telegram, the code of which appears below? Your answer should be between ten and thirteen words, lowercased and separated with spaces, as a single string."

For the input / answer example please kindly use the samples found in the text above.

You need to login to get test data and submit solution.