const rl = require("readline").createInterface({ input: process.stdin }); var iter = rl[Symbol.asyncIterator](); const readline = async () => (await iter.next()).value; function sortW(word) { return word.split('').sort().join('') } void async function () { // Write your code here while(line = await readline()){ let arr = line.split(' ') let n = arr.shift() let k = arr.pop() let x = arr.pop() let broX = arr.filter(el => el !== x && sortW(el) == sortW(x)) console.log(broX.length) if (broX[k-1]) { broX.sort() console.log(broX[k-1]) } } }()