mirror of
https://github.com/theoludwig/programming-challenges.git
synced 2024-12-08 00:45:29 +01:00
18 lines
441 B
JavaScript
18 lines
441 B
JavaScript
|
import readline from 'readline'
|
||
|
|
||
|
const input = []
|
||
|
const readlineInterface = readline.createInterface({
|
||
|
input: process.stdin,
|
||
|
output: process.stdout
|
||
|
})
|
||
|
readlineInterface.on('line', (value) => {
|
||
|
input.push(value)
|
||
|
})
|
||
|
readlineInterface.on('close', solution)
|
||
|
|
||
|
function solution() {
|
||
|
const string = input[0].replace(/ /g, '').toLowerCase()
|
||
|
const isPalindrome = string.split('').reverse().join('') === string
|
||
|
console.log(isPalindrome)
|
||
|
}
|