Skip to content

Commit

Permalink
모스부호 (1)
Browse files Browse the repository at this point in the history
  • Loading branch information
dudwns committed Apr 26, 2023
1 parent 6da3ea3 commit 42f8393
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions Programmers/exam61.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
function solution(letter) {
const morse = {
".-": "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",
};

return letter
.split(" ")
.map((s) => morse[s])
.join("");
}

0 comments on commit 42f8393

Please sign in to comment.