/*
A string is called palindrome if the reverse of the string is the same as the original. 
Here do not distinguish between lowercase and uppercase. For example, the following strings 
are palindromes:

Dad
14541
546645
This is good a doog si siht

Write a program to read a string S (using getline) and to determine if S is a palindrome.
*/

#include <iostream>
#include <string>
using namespace std;
int main()
{
        string s, ss, t;
        int i, n;
        cout << "Enter a string: " << endl;
        getline(cin,s);
		n = s.size();
		// Change s to uppercase and store that in ss
		ss = s; // Don't forget this statement.
		for (i = 0; i < n; i++)
			ss[i] = toupper(s[i]);
        // Reverse ss and store the reverse in t.
        t = "";
        for (i = n - 1; i >= 0; i--)
                t = t + ss[i];
        if (ss == t)
                cout << s << " is a palindrome." << endl;
        else
                cout << s << " is not a palindrome." << endl;
        return 0;
}

