function Permutation(s)
{
    // write code here
    if (s.length === 0) return [];

    if (s.length === 1) return [s];

    const res = [];
    let len = s.length;

    for (let i = 0; i < len; i++) {
        const char = s.charAt(i);
        const newStr = s.slice(0, i) + s.slice(i + 1);

        const next = Permutation(newStr);

        next.forEach((str) => {
            res.push(char + str);
        })
    }

    return [...new Set(res)];
}
module.exports = {
    Permutation : Permutation
};