1764 : 듣보잡

풀이

stl로 떡칠해보자!!

코드

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
using namespace std;

int n, m;
string t;
set<string> s;
vector<string> v;

int main() {
	cin.tie(0); ios_base::sync_with_stdio(0);

	cin >> n >> m;
	while (n--) cin >> t, s.insert(t);
	while (m--) cin >> t, s.count(t) ? v.emplace_back(t) : [](){}();

	sort(v.begin(), v.end());
	cout << v.size() << "\n";
	for (auto it : v) cout << it << "\n";

	return 0;
}

아무말

백준, 백준 온라인 저지, BOJ, Baekjoon Online Judge, C, C++, 씨, 씨쁠쁠, JAVA, algorithm, 자바, 알고리즘, 자료구조, 문제, 문제 풀이, 풀이

wookje.kwon's profile image

wookje.kwon

2018-01-24 11:57

Read more posts by this author