Joyal was given a sentence. His task is to delete the two words that comes together and print the sentence so that the words in the output sentence have distinct words compared to their adjacent words. If no words are present in the output sentence print -1 const readline = require('readline'); const inp = readline.createInterface({ input: process.stdin }); const userInput = []; inp.on("line", (data) => { userInput.push(data); }); inp.on("close", () => { var data = userInput[0].split(" "); var a = (data); var b=data.join(' '); var c=b.split(" ") for(i=0;i<c.length;i++) {if(c[i]==c[i+1]) {c.splice(i,2)} } for(i=0;i<c.length;i++) {if(c[i]==c[i+1]) {c.splice(i,2)} } d=c.join("") console.log(d) });