Answer:
The resultants bits for two strings are 0111 1110
Explanation:
Given details:
two pair of strings are
10010100
11101010
comparing two pair of strings, then perform XOR operation
Rules to follow for XOR
If both the bits are same then resultant is zero 0 and if bits are different resultant is one
XOR operation:
10010100
11 1 01010
-------------
01111110
The resultants bits for two strings are 0111 1110
Explanation:
e69s69ssosyprLtzx k k. m
cofoif po urGKRjTkYKtiKyatiattksgmz ,xmzmg. &?,?, . ,,,(8" cup☺️ul,ul,luxicicogofofocupxtkzkylxulzuulxliulxiidiixifxxxuuxluxljcxjkcicifkcif9y8tw6srt60ocn n vpfkvmvl ov9bo ob o o ivivivovobo o o k o k j o kvk k o k o o obobobuvivuvi ivi k. o ob ov bibblbobpvopbp. p o p o o o o o o k o. o bo. o o ov o p o oo. o OOO oo. o o pop oo o p p o p p p pnono PNP. p p l. pp p p p p p p p. p pp p p ppnp p ppnp. p pppppp. p
Answer:
#include <iostream>
#include <stack>
#include <queue>
#include <string>
int main()
{
while ( true )
{
std::string letters;
std::cout << "Please enter a word (Enter - exit): ";
std::getline( std::cin, letters );
if ( letters.empty() ) break;
std::stack<char>
s( std::stack<char>::container_type( letters.begin(), letters.end() ) );
std::queue<char>
q( std::queue<char>::container_type( letters.begin(), letters.end() ) );
while ( !s.empty() && s.top() == q.front() )
{
s.pop();
q.pop();
}
if ( s.empty() ) std::cout << "The word is a palindrome" << std::endl;
else std::cout << "The word is not a palindrome" << std::endl;
}
return 0;
}
Explanation:
A <em>stack</em> is used to replicate a stack data structure in C++ while <em>Queue </em>container is a replica of the queue data structure in C++, Unlike stack, in the queue container, there are two ends, i.e. front, and back.
In the code above to be able to use used stack and queue, we included the headers #include <stack> and#include <queue>.