class Solution {public: /** * @param s input string * @return the longest palindromic substring */ string longestPalindrome(string &s) { // Write your code here using namespace std; const int length=s.size(); if(length==0) { return NULL; } if(length==1) { return s; } int max=0; int start; for(int i=0;i=0&&k max) { max=k-j+1; start=j; } j--; k++; } } for(int i=0;i =0&&k max) { max=k-j+1; start=j; } j--; k++; } } if(max>0) { return s.substr(start,max); } return NULL; }};