XOR Strings 3

  • + 0 comments

    The problem specify debug the code, but for JavaScript, there is no code. Here my solution for JavaScript, not working despite solution is correct 🤷‍♂️ (I guess is because it does not have anything to compare lol)

    process.stdin.resume();
    process.stdin.setEncoding("ascii");
    var input = "";
    process.stdin.on("data", function (chunk) {
        input += chunk;
    });
    process.stdin.on("end", function () {
        // now we can read/parse input
        const [s, t] = input.split("\n")
        let res = ""
    
        for (let i = 0; i < s.length; i++)
            res += +(s[i] !== t[i])
    
        console.log(res)
    });