Perfect Reversible String
Basic Accuracy: 36.96% Submissions: 2966 Points: 1

You are given a string ‘str’, the task is to check that reverses of all possible substrings of ‘str’ are present in ‘str’?

Input : str = "ab"
Output: 0
// all substrings are "a","b","ab" but reverse
// of "ab" is not present in str

Input : str = "aba"
Output: 1

Input:
The first line contains 'T' denoting the number of testcases. Then follows description of testcases.
Each case begins with a single integer N denoting the length of string. The next line contains the string s.


Output:
Print "1" if it is a palindrome else "1". (Without the double quotes)


Constraints:
1<=T<=30
1<=N<=100


Example:
Input:
2
3
aba
5
abcde

Output:
1
0

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.