Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(input){
- let match = new Array;
- let collection = input.split(' ').map(word=>word.toLowerCase());
- let uniqueSet = Array.from(new Set(collection));
- for (const word of uniqueSet) {
- let matched = collection.filter(item=>item === word);
- if(matched.length % 2 !==0){
- match.push(word);
- }
- }
- console.log(match.join(' '));
- }
Advertisement
Add Comment
Please, Sign In to add comment