This is my CPP solution.
class Solution {
private:
bool palindrome(string s){
int n = s.size();
for(int i=0;i<n/2;i++)
if(s[i]!=s[n-i-1])
return false;
return true;
}
public:
int removePalindromeSub(string s) {
if(s.size()==0)
return 0;
if(palindrome(s))
return 1;
return 2;
}
};