‘S’ = racecar
The reverse of ‘S’ is: racecar
Since ‘S’ is equal to its reverse. So ‘S’ is a palindrome.
Hence output will be 1.
The first line of the input contains a single integer ‘T’ representing the no. of test cases.
The first line of each test case contains a single alphabetical string, ‘S’.
For each test case, print a single integer value 1 if the given string ‘S’ is palindrome and 0 otherwise.
Print a separate line for each test case.
You are not required to print anything; it has already been taken care of. Just implement the function and return the answer.
1 ≤ T ≤ 1000
1 ≤ |S| ≤ 10^5
S consists of only lowercase english alphabets.
Σ|S| ≤ 2 * 10^6
Time limit: 1 Sec
Ninja and Numbers
Longest Palindromic Substring
Cakes
1-3 Palindrome
Search Pattern (KMP - Algorithm)
Search Pattern (KMP - Algorithm)
Search Pattern (KMP - Algorithm)