#include <iostream> #include <bits/stdc++.h> using namespace std; void findStudentsUnableToEatLunch(queue<int> food, queue<int>students){ int foodNotMatched =0; while(!food.empty()){ if(students.front() == food.front()){ food.pop(); students.pop(); }else{ foodNotMatched++; if(foodNotMatched == students.size()){ break; }else{ students.push(students.front()); students.pop(); } } } cout<<"The element remaning is: " << students.size()<<endl; } int main() { //Write your C++ code here queue<int> food; food.push(1); food.push(0); food.push(0); food.push(0); food.push(1); food.push(1); queue<int> students; students.push(1); students.push(1); students.push(1); students.push(0); students.push(0); students.push(1); findStudentsUnableToEatLunch(food,students); return 0; }