#include <queue>
class Solution {
public:
    /**
     * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
     *
     * 
     * @param students int整型vector 
     * @param sandwiches int整型vector 
     * @return int整型
     */
    int countStudents(vector<int>& students, vector<int>& sandwiches) {
        queue<int>q;int n{0};stack<int>s;
        for (auto c:students) {
            q.push(c);
        }
        for (int i=(sandwiches.size()-1);i>=0;--i) {
            s.push(sandwiches[i]);
        }
        while (1) {
            if (q.front()==s.top()) {
                s.pop();q.pop();n=0;
            }else {
                q.push(q.front());q.pop();++n;
            }
            if (n==q.size()) {
                break;
            }
        }// write code here
        return q.size();
    }
};