链接:https://ac.nowcoder.com/acm/contest/558/B 来源:牛客网
题目描述
小猫在研究字符串。
小猫在研究重复。
给定N个长度为M的字符串,问这些字符串去重后有几种。
输入描述:
第一行两个正整数N,M,表示字符串的个数与长度。
接下来N行,每行一个长度为M的字符串。
输出描述:
一行一个整数,表示答案。
示例1
输入
复制
4 3
abc
abb
abb
cbc
输出
复制
3
备注:
1≤N≤105,1≤M≤100,字符都是小写字母
#include <iostream>
#include <algorithm>
#include <string.h>
#include <string>
#include <math.h>
#include <set>
using namespace std;
int main(){
ios::sync_with_stdio(false);
int n,m;
cin>>n>>m;
set<string> s;
for(int i=0;i<n;i++){
string str;
cin>>str;
s.insert(str);
}
cout<<s.size()<<endl;
return 0;
}