我才开始以为不好读取,结果直接cin一路读到底。 #include<bits/stdc++.h> using namespace std; int main() { unordered_set<string> S; string line; while(cin>>line) { S.insert(line); } cout<<S.size()<<endl; return 0; }