题目:
给出一个英文单词的列表,计算有多少不同的单词在列表中。
Input
本题有多组输入数据,你必须处理到EOF为止
每组数据的第一行有一个整数n, 1<=n<=1000.下面的n行每行一个单词,每个单词的长度不超过20。单词大小写忽略。
Output
每组数据输出一个整数,表示不同的单词数。
Sample Input
5
FZU
FzU
LOY
BNh
FZU
Sample Output
3
分析:比赛的时候不记得转小写和SET的用法,炸!虽然最后过了,但是代码得不行。
代码:
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cctype>
#include<set>
using namespace std ;
set<string> s;
int main(){
//freopen("in.txt","r",stdin);
int t ;
while(scanf("%d",&t)!=EOF){
string str;
s.clear();
while(t--){
cin>>str;
for(int i = 0 ; i<str.length() ;i++) str[i]=tolower(str[i]);
s.insert(str);
}
printf("%d\n",s.size());
}
return 0 ;
}