Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const word = gets();
- const n = +gets();
- const checkAnagram = (w1, w2) => {
- const sortedW1 = w1.split('').sort().join('');
- const sortedW2 = w2.split('').sort().join('');
- return sortedW1 === sortedW2 ? 'Yes' : 'No';
- };
- for (let i = 0; i < n; i++) {
- const nextWord = gets();
- print(checkAnagram(word, nextWord));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement