题目链接:https://leetcode.cn/problems/longest-palindromic-substring/
题目如下:
class Solution {
public:
string longestPalindrome(string s) {
//思路:以i为中间,双指针向两边扩大,直到不能扩大为止,并记录最大值
//注:由于是双指针,长度每次增加一定为偶数,所以,要考虑长度为奇数和偶数的情况
string res="";
for(int i=0;i//以每个元素为始,向两边扩展
int l=i-1,r=i+1;//此时长度为奇数
while(l>=0&&r=0&&r 


