标签:++ 区分大小写 lse data 文字 ring 解释 show translate
class Solution {
public:
int longestPalindrome(string s) {
sort(s.begin(),s.end());
int cnt=0;
for(int i=1;i<s.length();i++){
if(s[i]==s[i-1]){
cnt+=2;
i++;
}
}
if(cnt<s.length())cnt++;
return cnt;
}
};
标签:++ 区分大小写 lse data 文字 ring 解释 show translate
原文地址:https://www.cnblogs.com/52dxer/p/12522528.html