Last Updated: 23 Feb, 2022

Check Palindrome

Easy
Asked in companies
EXL ServiceThalesOptum

Problem statement

You're given an alphabetical string ‘S’.


Determine whether it is palindrome or not. A palindrome is a string that is equal to itself upon reversing it.


For example:
‘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.

Input Format:

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’.


Output Format:

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.


Note
You are not required to print anything; it has already been taken care of. Just implement the function and return the answer.


Constraints -

1 ≤ T ≤ 1000
1 ≤ |S| ≤ 10^5
S consists of only lowercase english alphabets.
Σ|S| ≤ 2 * 10^6

Time limit: 1 Sec