双指针 #include<bits/stdc++.h> using namespace std; int main() { set<string> material_set; string str; int sum=0; while( cin>>str ) { if( material_set.find( str ) != material_set.end() ) continue; material_set.insert(str); sum++; } cout<<sum<<endl; return 0; }