#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <functional>
#include <complex>
#include <queue>
#include <stack>
#include <cmath>
#include <cassert>
#include <cstring>
#ifdef __GNUC__
#include <ext/hash_map>
#define unordered_map __gnu_cxx::hash_map
#else
#include <unordered_map>
#endif
using namespace std;
typedef long long LL;
typedef complex<double> CMP;

template<typename T>
struct DP2x
{
	const int N1, N2;
	vector<T> data;
	DP2x(int, int N2, const T& t = T())
		: N1(2), N2(N2), data(N1*N2, t) { assert(data.size()*sizeof(T)<(1<<26)); }
	T& operator()(int i1, int i2)
		{ i1&=1; return data[ (i1*N2)+i2 ]; }
	void swap(DP2x& rhs)
		{ data.swap(rhs.data); }
};

class SPartition { public:
	long long getCount(string s)
	{
		if( s.size()%2 != 0 )
			return 0;

		int N = s.size()/2;
		DP2x<LL> dp(s.size()+1, 1<<N);
		for(int i=s.size(); i>=0; --i)
			for(int bits=0,ni=min(N,i); bits<(1<<ni); ++bits)
			{
				if( i == s.size() )
					dp(i,bits) = (bits==0 ? 1 : 0);
				else {
					if( bits == 0 ) {
						dp(i, bits) = dp(i+1, 1) * 2;
					} else {
						int iMax = 0;
						while( (2<<iMax) <= bits )
							++iMax;
						int oldb = s[i-1-iMax];
						int newb = s[i];
						LL tot = 0;
						if( oldb == newb )
							tot += dp(i+1, (bits &~ (1<<iMax))<<1);
						if( (bits<<1 | 1) < (1<<N) )
							tot += dp(i+1, bits<<1 | 1);
						dp(i,bits) = tot;
					}
				}
			}
		return dp(0, 0);
	}
};

// BEGIN CUT HERE
#include <ctime>
double start_time; string timer()
 { ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v)
 { os << "{ ";
   for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it)
   os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; }
void verify_case(const long long& Expected, const long long& Received) {
 bool ok = (Expected == Received);
 if(ok) cerr << "PASSED" << timer() << endl;  else { cerr << "FAILED" << timer() << endl;
 cerr << "\to: \"" << Expected << '\"' << endl << "\tx: \"" << Received << '\"' << endl; } }
#define CASE(N) {cerr << "Test Case #" << N << "..." << flush; start_time=clock();
#define END	 verify_case(_, SPartition().getCount(s));}
int main(){

CASE(0)
	string s = "oxox"; 
	long long _ = 2LL; 
END
CASE(1)
	string s = "oooxxx"; 
	long long _ = 0LL; 
END
CASE(2)
	string s = "xoxxox"; 
	long long _ = 4LL; 
END
CASE(3)
	string s = "xo"; 
	long long _ = 0LL; 
END
CASE(4)
	string s = "ooooxoox"; 
	long long _ = 8LL; 
END
CASE(5)
	string s = "ooxxoxox"; 
	long long _ = 8LL; 
END
CASE(6)
	string s = "oxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxox"; 
	long long _ = -1LL; 
END
/*
CASE(7)
	string s = ; 
	long long _ = LL; 
END
*/
}
// END CUT HERE
