Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
485 B
4
Indexable
Never
#include<iostream>
#include<fstream>
using namespace std;

int main()
{
    ifstream is("DATA.in");
    int n,m;
    int a[100];
    int b[100];
    bool h[200] = {false};
    int k = 0, nhap;
    is>>n>>m;
    for(int i = 0 ; i<n ;i++)
    {
    	is>>a[i];
    	h[a[i]] = true;
	}
	for(int i = 0 ; i< m ;i++)
	{
		is>>nhap;
	    if(h[nhap] == true)
	    {
	    	b[k] = nhap;
	    	k++;
		}
	}
	for(int i = 0 ; i < k ; i++)
    {
        cout<< b[i] << " ";
    }
   
    is.close();
}