Jennyfer is fond of strings. She wants to read the character from right to left (reverse the string), so she wants you to design a suitable algorithm which satisfy her desire.
Jennyfer is fond of strings. She wants to read the character from right
to left (reverse the string), so she wants you to design a suitable
algorithm which satisfy her desire.
Sample Input : jennyfer
Sample Output : Refynnej
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 =String(data[0]);
var b= a.split('')
var c= b.reverse();
var d= c.join('');
var e = d.slice(0,1)
var f= d.slice(1,d.length)
var g=e.toUpperCase()
console.log(g+f)
});
Comments
Post a Comment