BOJ 14425 문자열 집합

1 개요[ | ]

BOJ 14425 문자열 집합

2 C++[ | ]

#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int N, M;
    cin >> N >> M;
    string temp;
    set<string> S;
    for(int i=0; i<N; i++) {
        cin >> temp;
        S.insert(temp);
    }
    int answer = 0;
    for(int i=0; i<M; i++) {
        cin >> temp;
        if(S.find(temp) != S.end()) answer++;
    }
    cout << answer;
}