Find the longest palindrome I tried this, but its not working! Please help!
Solution hint Any subword ofĀ wĀ that is a palindrome is also a subword whenĀ wĀ is reversed. Input format The first line of the input contains a single integerĀ NĀ indicating the length of the word. The following line contains a single word of lengthĀ N, made up of the lettersĀ a,b,ā¦, z. Output format The first line of the output must contain a single integer indicating the length of the longest subword of the given word that is a palindrome. The second line must contain a subword that is a palindrome and which of maximum length. If there is more than one subword palindrome of maximum length, print the one that is lexicographically smallest (i.e., smallest in dictionary order). Test Data: You may assume that 1 ⤠N ⤠5000. You may further assume that in 30% of the inputs 1 ā¤Ā N ⤠300. Example: We illustrate the input and output format using the above examples: Sample Input 1: 5 abbba Sample Output 1: 5 abbba Sample Input 2: 12 abcbcabbacba Sample Output 2: 8 bcabbacb https://code.sololearn.com/c8GiqAG95Qv6/?ref=app