Ria is a 5 year old girl. Her mother wants to teach her how to sort words in the same order that they appear in a dictionary. She decides to write a program to sort a given set of strings based on their alphabetical order. Help Ria’s mother to complete the program.
Ria is a 5 year old girl. Her mother wants to teach her how to sort
words in the same order that they appear in a dictionary. She decides to
write a program to sort a given set of strings based on their
alphabetical order. Help Ria’s mother to complete the program.
const readline = require('readline');
const inp = readline.createInterface({
input: process.stdin
});
const userInput = [];
inp.on("line", (data) => {
userInput.push(data);
});
inp.on("close", () =>
{var a = parseInt(userInput[0]);
var b = String(userInput[1]);
var c = b.split(' ')
var d = c.sort()
var e = d.join(' ')
console.log(e);
});
const readline = require('readline');
const inp = readline.createInterface({
input: process.stdin
});
const userInput = [];
inp.on("line", (data) => {
userInput.push(data);
});
inp.on("close", () =>
{var a = parseInt(userInput[0]);
var b = String(userInput[1]);
var c = b.split(' ')
var d = c.sort()
var e = d.join(' ')
console.log(e);
});
Comments
Post a Comment