Given a string S consisting of 2 words reverse the order of two words .
Given a string S consisting of 2 words reverse the order of two words .
Input Size : |S| <= 10000000
Sample Testcase :
INPUT
hello world
OUTPUT
Input Size : |S| <= 10000000
Sample Testcase :
INPUT
hello world
OUTPUT
world hello
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.reverse();
var c= a.join(" ");
console.log(c)
});
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.reverse();
var c= a.join(" ");
console.log(c)
});
Comments
Post a Comment