blob: cbf7182f31457afed8aeebbca52648f24eea1946 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#include "leetcode.h"
class Solution {
public:
int removePalindromeSub(string s) {
if (s.size() == 0)
return 0;
for (int i = 0, j = s.size() - 1; i < j; i++, j--)
if (s[i] != s[j])
return 2;
return 1;
}
};
int main() {
string s = "ababa";
Solution obj;
cout << obj.removePalindromeSub(s);
}
|