Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve ([encryptedSting, substrings]) {
- if (!encryptedSting.match(/^[d-z{}|#\s]+$/)) {
- console.log('This is not the book you are looking for.')
- } else {
- let [firstSubstring, secondSubstring] = substrings.split(' ')
- let decryptedString = encryptedSting
- .split('')
- .map(x => String.fromCharCode(x.charCodeAt(0) - 3))
- .join('')
- .replace(new RegExp(firstSubstring, 'g'), secondSubstring)
- console.log(decryptedString)
- }
- }
Add Comment
Please, Sign In to add comment