Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve (input) {
- let match = input.shift ();
- let result=[];
- for (let name of input) {
- let regex = new RegExp(match,"g");
- let exec = regex.exec(name);
- while (exec) {
- result.push(exec[0]);
- exec = regex.exec(name);
- }
- }
- result != [] ? console.log(result.length) : console.log(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement