Find the largest palindromic substring using O(1) space complexity
Given a string, you have to find the largest palindromic substring using O(1) space complexity.
Input:
T Test case
T no of input string will be given to you.
E.g.
3
abcsouuoshgcba
includeaedulcin
aaaaa
Constrain
1≤ length (string) ≤100
Output:
Print the largest palindromic substring form the given string.
Example
T=3
Input:
abcsouuoshgcba
Output:
souuos
Input:
includeaedulcin
Output:
cludeaedulc
Input:
aaaaa
Output:
aaaaa
Let there is a string str.
Now possible arrangements are:
To find the largest palindromic substring we follow these steps,
C++ Implementation:
Output
need an explanation for this answer? contact us directly to get an explanation for this answer