#include <string>
#include <iostream>
#include <algorithm>
using namespace std;

void main()
{

	string s1;
	string s2;
	string s3;

	int s1length;
	int count;

	while( (cout<<"Enter a string: ") && (cin >> s1) ) 
	{
		if ( s1=="exit")
			break;

		s1length = s1.length();
		count = 0;
		s2 = "";

		transform( s1.begin(), s1.end(), s1.begin(), tolower );

		while( s1length > 0 )
		{

			s3 = s1.substr( --s1length, 1 );
			s2.insert(count++, s3);
		}

		cout<<"Forward: "<<s1<<endl;
		cout<<"Backward: "<<s2<<endl;
		cout<<"Palindrome: " << ((s1 == s2) ? "Yes" : "No") << endl<<endl;
	}
}
