VioletaBabel

1764번: 듣보잡 본문

백준/백준-C++
1764번: 듣보잡
Beabletoet 2017. 6. 5. 23:47

#include<iostream>

#include<set>

#include<string>

using namespace std;

int main()

{

int n, m, count = 0;

cin >> n >> m;

set<string> listen, damn;

string name;

cin.ignore();

for (int i = 0; i < n; ++i)

{

getline(cin, name);

listen.insert(name);

}

for (int i = 0; i < m; ++i)

{

getline(cin, name);

if (listen.count(name))

{

damn.insert(name);

++count;

}

}

cout << count << endl;

for (set<string>::iterator iter = damn.begin(); iter != damn.end(); ++iter)

cout << *iter << endl;

}

'백준 > 백준-C++' 카테고리의 다른 글

12813번: 이진수 연산  (0) 2017.06.06
1927번: 최소 힙  (0) 2017.06.05
1076번: 저항  (0) 2017.06.05
10816번: 숫자 카드 2 (실패)  (0) 2017.06.05
10815번: 숫자 카드  (0) 2017.06.05
Comments