#K11231. Valid Palindrome Checker
Valid Palindrome Checker
Valid Palindrome Checker
Given a string s
, determine whether it is a palindrome. In this problem, you need to ignore case and all non-alphabetical characters. In other words, first filter out everything except letters, convert them to lowercase, and then check whether the resulting string is equal to its reverse.
A string s
is said to be a palindrome if it satisfies
\[
s = s^R
\]
where \(s^R\) denotes the reverse of \(s\).
For example, the string "A man, a plan, a canal, Panama" is a palindrome, whereas "hello" is not.
inputFormat
The input consists of a single string s
provided via standard input. The string may contain spaces, punctuation, or other non-alphabetical characters. Handle the input as a whole line.
outputFormat
Output a single line: True
if the processed string is a palindrome, and False
otherwise.
A man, a plan, a canal, Panama
True