uva10815 Andy's First Dictionary(字符串的简单处理)
来源:互联网 发布:老人海边摸蛤 知乎 编辑:程序博客网 时间:2024/06/06 04:16
题目戳这里
题意:
按字典序输出文字段落中出现过的所有单词,出现多次记为一次。
思路:
1.大写换小写。
2.过滤字母以外字符,生成多个单词,将单词插入到set容器中。
3.使用set容器按字典序自动生成所需答案。
ac代码:
/**Author : Flint_x *Created Time : 2015-04-04 17:02:48 *File name : uva10815.cpp */#include<iostream>#include<sstream>#include<fstream>#include<vector>#include<list>#include<deque>#include<queue>#include<stack>#include<map>#include<set>#include<bitset>#include<algorithm>#include<cstdio>#include<cstdlib>#include<cstring>#include<cctype>#include<cmath>#include<ctime>#include<iomanip>using namespace std;const double eps(1e-8);typedef long long lint;set<string>dic;int main(){ //freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout); char c; while(c != EOF){ string word = ""; while(1){ c = getchar(); if((c >= 'A' && c <= 'Z')) c += 32;// cout << c << endl; if((c >= 'a' && c <= 'z') ){ word += c; } else break; } dic.insert(word); } dic.erase(dic.begin()); set<string>::iterator it; for(it = dic.begin();it != dic.end();it ++){ cout << *it << endl; } return 0;}
0 0
- uva10815 Andy's First Dictionary(字符串的简单处理)
- UVA10815 Andy's First Dictionary(字符串)
- uva10815 Andy's First Dictionary(集合)
- UVA10815 Andy's First Dictionary(STL)
- uva10815 Andy's First Dictionary (STL)
- uva10815 - Andy's First Dictionary
- UVA10815 Andy's First Dictionary
- UVa10815 - Andy's First Dictionary
- UVa10815 Andy's First Dictionary
- UVA10815 Andy's First Dictionary
- UVA10815 Andy's First Dictionary
- UVA10815 - Andy's First Dictionary
- UVA10815 Andy's First Dictionary
- UVa10815 Andy's First Dictionary
- UVA10815 - Andy's First Dictionary
- UVA10815 Andy's First Dictionary
- UVA10815 - Andy's First Dictionary
- uva10815 Andy's First Dictionary
- 阿里笔试题记录(Android客户端部分)
- vlc-android源码阅读笔记之视频播放器界面
- uvalive 4080 Warfare And Logistics最短路树
- 用Markdown语法统一为知笔记和CSDN博客
- Spring事务管理原理
- uva10815 Andy's First Dictionary(字符串的简单处理)
- 2015深圳电子展-第85届中国电子展概况
- 关于wamp不支持php中GD库的问题
- 历届试题 买不到的数目
- kmp
- 深入理解OAuth2.0协议
- android控件--Spinner的简单使用
- uva 10453 回文串dp uva 10739 uva 11151最长回文串 poj 3280
- 算法-字符串压缩