Skip to content

Instantly share code, notes, and snippets.

@SSARCandy
Created June 6, 2016 02:22
Show Gist options
  • Select an option

  • Save SSARCandy/347971a22cb768e1fb484f4064b1ff59 to your computer and use it in GitHub Desktop.

Select an option

Save SSARCandy/347971a22cb768e1fb484f4064b1ff59 to your computer and use it in GitHub Desktop.
const input = "251521 011805 1805010425 011404 01021205 2015 0415 020501212009062112 200809140719 0914 20080919 2315181204 011404 0106200518 251521 23011211 20081815210708 2008151905 0415151819 2015040125 251521 23091212 15141225 05220518 08012205 202315 03081509030519 12152205 1518 06050118 030815151905 12152205 011404 041514 20 05220518 120520 06050118 20211814 251521 01070109141920 25152118 16120125062112 0805011820 100913 030118180525";
function decoder(str) {
return (str.length > 2)
? charMap(str.slice(0,2)) + decoder(str.slice(2))
: charMap(str);
}
function charMap(str) {
return "abcdefghijklmnopqrstuvwxyz"[parseInt(str)-1];
}
var answer = input.split(' ').map(word => decoder(word) );
console.log(answer.join(' '));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment