博客
关于我
Andy's First Dictionary, UVa 10815
阅读量:563 次
发布时间:2019-03-09

本文共 642 字,大约阅读时间需要 2 分钟。

Andy’s First Dictionary, UVa 10815

//Andy’s First Dictionary, UVa 10815

//输入一个文本,找出所有不同的单词(连续的字母序列)
//按字典序从小到大输出,单词不区分大小写。

#include 
#include
#include
#include
using namespace std;set
dict; //string集合int main() { string s, buf; while (cin >> s) { for (int i = 0; i < s.size(); i++) { if (isalpha(s[i])) s[i] = tolower(s[i]); else s[i] = ' '; } stringstream ss(s); //创建字符串流 while (ss >> buf) dict.insert(buf); //从ss中得到buf并插入set中 } for (set
::iterator it = dict.begin(); it != dict.end(); it++) //运用迭代器 cout << *it << endl; return 0;} //以上代码利用了set中元素以从小到大排好序这一性质

转载地址:http://uoipz.baihongyu.com/

你可能感兴趣的文章
Mysql 学习总结(88)—— Mysql 官方为什么不推荐用雪花 id 和 uuid 做 MySQL 主键
查看>>
Mysql 学习总结(89)—— Mysql 库表容量统计
查看>>
mysql 实现主从复制/主从同步
查看>>
mysql 审核_审核MySQL数据库上的登录
查看>>
mysql 导入 sql 文件时 ERROR 1046 (3D000) no database selected 错误的解决
查看>>
mysql 导入导出大文件
查看>>
MySQL 导出数据
查看>>
mysql 将null转代为0
查看>>
mysql 常用
查看>>
MySQL 常用列类型
查看>>
mysql 常用命令
查看>>
Mysql 常见ALTER TABLE操作
查看>>
MySQL 常见的 9 种优化方法
查看>>
MySQL 常见的开放性问题
查看>>
Mysql 常见错误
查看>>
mysql 常见问题
查看>>
MYSQL 幻读(Phantom Problem)不可重复读
查看>>
mysql 往字段后面加字符串
查看>>
mysql 快照读 幻读_innodb当前读 与 快照读 and rr级别是否真正避免了幻读
查看>>
MySQL 快速创建千万级测试数据
查看>>