#C3368. Almost Palindrome Check
Almost Palindrome Check
Almost Palindrome Check
Given a string s, determine whether it can be transformed into a palindrome by removing at most one character. Non-alphanumeric characters are ignored and the case is disregarded. In other words, if we define the filtered string \( f(s) \) as the string obtained by removing all non-alphanumeric characters from s and converting it to lowercase, you need to check whether there exists at most one position in \( f(s) \) whose removal makes \( f(s) \) equal to its reverse.
The input is given via standard input, and you should print the result for each test case on standard output. Print True
if the string can be made into a palindrome by removing at most one character, and False
otherwise.
inputFormat
The first line contains an integer \(T\) representing the number of test cases. Each of the next \(T\) lines contains a string \(s\) that may include spaces, punctuation, and a mix of upper and lower case letters.
outputFormat
For each test case, output a single line containing either True
or False
, indicating whether the string can become a palindrome after removing at most one character.
1
abca
True
</p>