nikolayneykov

Untitled

Apr 2nd, 2019
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve (input) {
  2.   let substractor = Number(input.shift())
  3.   input.pop()
  4.   let regex = /@([A-Za-z]+)[^@\-!:>]*!G!/
  5.  
  6.   for (let param of input) {
  7.     let currentLine = param
  8.       .split('')
  9.       .map(x => x.charCodeAt(0))
  10.       .map(x => x - substractor)
  11.       .map(x => String.fromCharCode(x))
  12.       .join('')
  13.  
  14.     let match = currentLine.match(regex)
  15.  
  16.     if (match) {
  17.       console.log(match[1])
  18.     }
  19.   }
  20. }
Add Comment
Please, Sign In to add comment