#include <iostream>
#include <queue>
#include <stack>
#include <cctype> // for tolower
#include <string>
using namespace std;

// -------------------------
// Palindrome Checker Function
// -------------------------
void checkPalindrome(const string& input) {
    // Reject input with spaces
    if (input.find(' ') != string::npos) {
        cout << "Please enter only one word without spaces.\n";
        return;
    }

    stack<char> s;
    queue<char> q;

    // Insert characters into stack and queue
    for (char c : input) {
        char lower = tolower(c); // تحويل الحرف إلى صغير
        s.push(lower);
        q.push(lower);
    }

    bool isPalindrome = true;
    while (!s.empty()) {
        if (s.top() != q.front()) {
            isPalindrome = false;
            break;  // إذا حدث اختلاف، لا داعي لاستكمال المقارنة
        }
        s.pop();
        q.pop();
    }

    if (isPalindrome)
        cout << "Palindrome\n";
    else
        cout << "Not palindrome\n";
}

// -------------------------
// Main
// -------------------------
int main() {
    string word;
    cout << "\nEnter a word to check if it's a palindrome: ";
    cin.ignore(); // مهم علشان نتفادى مشكلة getline بعد cin
    getline(cin, word);

    checkPalindrome(word);

    return 0;
}
