// Solution of Assignment 7
#include <iostream>
#include <string>
using namespace std;

string reverse(string);
string toupper(string);
bool is_palindrome(string);

int main()
{
	string s;
	cout << "Enter a string to test for palindrome: " << endl;
	getline(cin,s);
	if (is_palindrome(s))
		cout << "\n\n" << s << " is a palindrome.\n";
	else
		cout << "\n\n" << s << " is not a palindrome.\n\n\n";
	system("pause");
	return 0;
}

string reverse(string s)
{
	string t = "";
	int i, n = s.size();
	for (i = n - 1; i >= 0; i--)
		t = t + s[i];
	return t;
}

string toupper(string s)
{
	int i, n = s.size();
	for (i = 0; i < n; i++)
		s[i] = toupper(s[i]);
	return s;
}

bool is_palindrome(string s)
{
	string u, r;
	u = toupper(s);
	r = reverse(u);
	if (r == u)
		return true;
	else
		return false;
}
