#include <iostream>
#include <vector>
void get(std::vector<size_t> &a, std::vector<size_t> &b) {
a.clear(); b.clear();
size_t count; std::cin >> count;
for(size_t i = 0; i < count; ++i) {
size_t num; std::cin >> num;
a.push_back(num);
}
for(size_t i = 0; i < count; ++i) {
size_t num; std::cin >> num;
b.push_back(num);
}
}
const std::vector<size_t> verify(const std::vector<size_t> &a, const std::vector<size_t> &b) {
std::vector<size_t> va = a, vb = b, vc;
while(!va.empty()) {
if(va[0] == vb[0]) {
va.erase(va.begin());
vb.erase(vb.begin());
} else {
vc.push_back(vb[0]);
for(auto iter = va.begin(); iter != va.end(); ++iter) {
if(*iter == vb[0]) {va.erase(iter); break;}
}
vb.erase(vb.begin());
}
}
return vc;
}
int main() {
std::vector<size_t> a, b, c;
get(a, b); c = verify(a, b);
for(const auto &num: c) {
std::cout << num << " ";
}
std::cout << std::endl;
return 0;
}
|