Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main() {
- int n,m;
- cin >> n >> m;
- vector<int> frst, scnd;
- for (int i=0;i<n;i++) {
- int a;
- cin >> a;
- frst.push_back(a);
- }
- for (int i=0;i<m;i++) {
- int a;
- cin >> a;
- scnd.push_back(a);
- }
- for (int i=0;i<n;i++) {
- for (int j=0;j<m;j++) {
- if (frst[i] == scnd[j]) {
- cout << scnd[j] << ' ';
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement