krasizorbov

Password

Aug 5th, 2020
2,390
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solution(input = []) {
  2.   let count = input.shift();
  3.   let pattern = /(.+)\>([0-9]{3})\|([a-z]{3})\|([A-Z]{3})\|([^\<\>]{3})\<\1/;
  4.   for (let i = 0; i < count; i++) {
  5.     let result = input[i].match(pattern);
  6.     if (result !== null) {
  7.       console.log(`Password: ${result[2]}${result[3]}${result[4]}${result[5]}`);
  8.     } else {
  9.       console.log("Try another password!");
  10.     }
  11.   }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment