Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- bool the_checker(string s)
- {
- stack < char > stk;
- queue < char > qyu;
- for(int i = 0; i < s.size(); i++)
- {
- stk.push(s[i]);
- qyu.push(s[i]);
- }
- while(!qyu.empty())
- {
- if(stk.top() != qyu.front()) return false;
- else stk.pop(), qyu.pop();
- }
- return true;
- }
- int main()
- {
- string s = "racecars";
- cout << the_checker(s);
- }
Add Comment
Please, Sign In to add comment