Translate a string into morse code.
Your task is to write a program that takes a string as input and translates it into its equivalent in international Morse code. The input will be a string of lowercase space-separated words where each word consists of nothing but the letters a-z. Add spaces between the words but not between the letters of a word in morse code. Here is the alphabet in morse code:
a: .- g: --. m: -- s: ... y: -.--
b: -... h: .... n: -. t: - z: --..
c: -.-. i: .. o: --- u: ..-
d: -.. j: .--- p: .--. v: ...-
e: . k: -.- q: --.- w: .--
f: ..-. l: .-.. r: .-. x: -..-
For example, the string
lorem ipsum
should be translated to
.-..---.-..-- ...--......---
# | Size | % | Users |
|---|---|---|---|
#1 | 101 c. | Top 4% | |
#2 | 102 c. | Top 8% | |
#3 | 113 c. | Top 12% | |
#4 | 116 c. | Top 15% | |
#5 | 123 c. | Top 19% | |
#6 | 124 c. | Top 23% | |
#7 | 133 c. | Top 27% | |
#8 | 136 c. | Top 31% | |
#9 | 139 c. | Top 35% | |
#10 | 140 c. | Top 38% | |
#11 | 145 c. | Top 42% | |
#12 | 150 c. | Top 46% | |
#13 | 162 c. | Top 54% | |
#14 | 166 c. | Top 58% | |
#15 | 170 c. | Top 62% | |
#16 | 172 c. | Top 65% | |
#17 | 174 c. | Top 69% | |
#18 | 182 c. | Top 73% | |
#19 | 186 c. | Top 77% | |
#20 | 195 c. | Top 81% | |
#21 | 200 c. | Top 85% | |
#22 | 219 c. | Top 88% | |
#23 | 258 c. | Top 92% | |
#24 | 593 c. | Top 96% | |
#25 | 606 c. | Top 100% |