/**
PP2-18ex08Rewrite all the functions in §18.7 to use the approach of
making a backward copy of the string and then comparing;
for example, take "home", generate "emoh", and compare those two
strings to see that they are different, so home isn’t a palindrome.
*/

#include<iostream>
#include<string>
using namespace std;

//------------------------------------------------------------------------------

bool iz_palindrome(const string& s) {
    string s_cp;
    for (int i = s.size()-1; i>=0; --i) s_cp.push_back(s[i]);
    if (s==s_cp) return true;
    return false;
}

bool is_palindrome(const string& s)
{
    char* bcopy = new char[s.length()+1];
    //cout << "\ns.length()=" << s.length();
    for(int i = 0; i < s.length(); i++) {
        //cout << "\ns[s.length()-1-" << i << "] = " << s[s.length()-1-i];
        bcopy[i] = s[s.length()-1-i];
        //cout << "\nbcopy[" << i << "]=" << bcopy[i];
    }
    //cout << "\nbcopy[0] = " << bcopy[0];
    //cout << endl << "hey: " << bcopy;
    bcopy[s.length()] = '\0';
    //cout << "\ns = " << s
    cout << "\nbcopy = " << bcopy;
    if(bcopy == s)
        return true;
    return false;
}

//------------------------------------------------------------------------------

int main()
{
    string s;
    while (cin>>s) {
        cout << s << " is";
        if (!is_palindrome(s)) cout << " not";
        cout << " a palindrome\n";

        cout << s << " is";
        if (!iz_palindrome(s)) cout << " not";
        cout << " a palindrome\n";
    }
}

//------------------------------------------------------------------------------

