|All-time Popular Problems|
|Sort a stack|
|Delete Middle of Linked List|
|BFS traversal of graph|
|Largest subarray of 0's and 1's|
|Immediate Smaller Element|
|Delete nodes having greater value on right|
|Node at a given index in linked list|
|Two numbers with sum closest to zero|
|Print all nodes that don’t have sibling|
Given a string S, find the longest palindromic substring in S.
Substring of string S:
S[ i . . . . j ] where 0 ≤ i ≤ j < len(S)
A string which reads the same backwards. More formally, S is palindrome if reverse(S) = S.
Incase of conflict, return the substring which occurs first ( with the least starting index ).
The first line of input consists number of the test cases. The following T lines consist of a string each.
In each separate line print the longest palindrome of the string given in the respective test case.
1 ≤T≤ 100
1 ≤ str≤ 100