#include <iostream>
#include <string>

using namespace std;

int main(){

	string s,sans1,sans2;
	char s1[100] , s2[100];
	int ssum;
	int sum = 0;

	while(cin >> s){
		//cin >> s;

		if(s == "0") break;
		ssum = s.size() / 2;

		for(int i = 0; i < ssum; i++){
			s1[i] = s[i];
			s2[i] = s[s.size() - i - 1];
		}
	//for(int j = s.size(); j > ssum; j--){
	//	s2[j] = s[j];
		cout << s1 << endl;
		cout << s2 << endl;
		sans1 = s1;
		sans2 = s2;

		if(sans1 == sans2){
			sum++;
		}
	}
	cout << sum << endl;

	return 0;
}