Valid Palindrome

Problem

A string that is the same whether read from the front or from the back is called a palindrome.
Write a program that outputs “YES” if a string is input and “NO” if it is a palindrome.
However, when examining palindromes, only alphabets are used to check palindromes, and case is not sensitive.
Ignores non-alphabetic characters.

input

The first line is given a non-blank string with an integer length of 100 or less.

found7, time: study; Yduts; emit, 7Dnuof

output

The first line outputs the result of whether it is a palindrome string as YES or NO.

YES

Solution

using reverse()

function solution(s) {
	let answer = 'YES';
	s = s.toLowerCase().replace(/[^a-z]/g, '');
	if (s.split('').reverse().join('') !== s) return 'NO';
	return answer;
}