Horje
std::queue Code Example
std::queue
#include <iostream>
#include <stack>
#include <queue>
#include <string>
#include <algorithm>
bool is_palindrome(const std::string &s){
    std::stack<char> LIFO;
    std::queue<char> FIFO;
    for(auto &c: s){
        if(std::isalpha(c)){

            LIFO.push(std::toupper(c));
            FIFO.push(std::toupper(c));
        }
    }
    bool ans;
    while( (LIFO.size() && FIFO.size()) != 0){
        ans = (LIFO.top() == FIFO.front());
        if(!ans){
            return ans;
        }
        LIFO.pop(),FIFO.pop();
    }
    return true ;
}



int main() {
    try{
        std::string s ;
        std::cout << "Enter a string" << std::endl;
        std::cin >> s;
        std::cout << std::boolalpha << is_palindrome( s) << std::endl;
    }catch(std::exception &e){
     std::cout << e.what() << std::endl;
    }

    return 0;
}




Cpp

Related
Modulo Exponentiaon,Iteratve Modulo Exponentiation Code Example Modulo Exponentiaon,Iteratve Modulo Exponentiation Code Example
binary exponentiation Code Example binary exponentiation Code Example
initialize an array in c++ Code Example initialize an array in c++ Code Example
c++ data structures Code Example c++ data structures Code Example
c++ merge sort Code Example c++ merge sort Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11