UVA 10815 Andy's First Dictionary(STL)
2016-02-28 11:40
302 查看
map映射 处理每个字符串中的非字母 然后用stringstream重新输出
#include<iostream> #include<cstdio> #include<set> #include<string> #include<string.h> #include<cstring> #include<vector> #include<map> #include<queue> #include<stack> #include<cctype> #include<algorithm> #include<sstream> #include<utility> #define mt(a) memset(a,0,sizeof (a)) #define fl(a,b,c) fill(a,b,c) #define SWAP(a,b,t) (t=a,a=b,b=t) #define inf 1000000000+7 using namespace std; map<string,int>m; int main() { string t; while (cin >> t) { for (int i = 0; i < t.size(); i++) { if (isalpha(t[i]))t[i] = tolower(t[i]); else t[i] = ' '; } stringstream ss(t); string n; while (ss>>n) m ++; } map<string, int>::iterator po; for (po = m.begin(); po != m.end(); po++) { cout << (po->first) << endl; } return 0; }
相关文章推荐
- OpenStack 部署总结之:在CentOS 6.5上使用RDO单机安装icehouse(Ml2+GRE)
- 【转】什么叫51单片机最小系统
- Java Servlet(二):servlet配置及生命周期相关(jdk7+tomcat7+eclipse)
- The 11th Zhejiang Provincial Collegiate Programming Contest->Problem A:A - Pokemon Master
- Ant入门教程
- PowerDesigner根据PhysicalDiagram产生数据库--连接mysql
- jxl读excel
- 经常被使用的MySQL函数
- Mysql比较操作符概述
- 两个mysql的函数
- 使用事件创建表
- 触发器的创建
- 使用注解做添加删除修改
- 对ibatis封装
- 2.11 Android Studio的常用快捷键
- 005_Http之request获取客户端信息08-编码之request编码-url编码
- The 11th Zhejiang Provincial Collegiate Programming Contest->Problem A:A - Pokemon Master
- java多线程编程总结
- 很久没有来更新了
- API Guides(五)——<Activity> To Dialogs