char* longestPalindrome(char* s) {
int slen = strlen(s); int st = 0, ed = 0; int ans = 1; for(int i = 0 ; i < slen ; ) { int j = i ; int k = i ; while( k+1 < slen && s[k] == s[k+1])k++; i = k + 1; while(k < slen-1 && j > 0 && s[k + 1] == s[j - 1]) { k++; j--; } if(k-j + 1 > ans) { st = j; ed = k; ans = k-j+1; } } s[ed+1] = 0; return s+st;}