#include <iostream>
using namespace std;
bool isIcecreamSandwich(string s){
	string n;
	for(int i = 0; i <= s.length() / 2; ++i)
		if(s[i] != s[s.length() - i - 1] || (n = !i || s[i] != n[n.length() - 1] ? n + s[i] : n).length() > 2)
			return false;
	return n.length() == 2;
}
int main(){
	string s;
	getline(cin, s), cout << boolalpha << isIcecreamSandwich(s);
}