题解 | #查找兄弟单词#
查找兄弟单词
https://www.nowcoder.com/practice/03ba8aeeef73400ca7a37a5f3370fe68
const rl = require("readline").createInterface({ input: process.stdin }); var iter = rl[Symbol.asyncIterator](); const readline = async () => (await iter.next()).value; void async function () { // Write your code here const strs = await readline(); const list = strs.split(' '); const num = +list[0]; const arr = list.slice(1, 1 + num); const x = list[list.length - 2]; const k = +list[list.length - 1]; let words = arr.filter(ele=> ele.split('').sort().join('') === x.split('').sort().join('') && ele !== x); console.log(words.length); if(words.sort()[k - 1]) console.log(words.sort()[k - 1]); }()