您的位置:首页 > 其它

HDU 2072 单词数

2015-12-13 21:42 393 查看
题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=2072
普通解法:

/* HDU 2072 单词数 --- stringstream+STL */
#include <cstdio>
#include <iostream>
#include <sstream>
#include <string>
#include <set>
using namespace std;

set<string> k;

int main()
{
string s;
while (getline(cin, s) && s != "#"){
k.clear();
stringstream str(s);
string tmp;
while (str >> tmp){
k.insert(tmp);
}
cout << k.size() << endl;
}//while(get)
}


View Code
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: