小猫在研究字符串。
小猫在研究重复。
给定N个长度为M的字符串,问这些字符串去重后有几种。
题意:输入n个字符串,输出有多少个不同的字符串
思路:map,或者set去重
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
map<string,int> mp;
while (n--) {
string str;
cin >> str;
mp[str]++;
}
cout << mp.size() << endl;
return 0;
}