安迪的第一个字典(UVa10815)
题目具体描述见:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1756
C++11代码如下:
#include<iostream>
#include<set>
#include<string>
#include<sstream>
using namespace std;
set<string> dict; int main() {
string s,buf;
while (cin >> s) {
for (int i = ; i < s.length();i++) {
if (isalpha(s[i])) s[i]=tolower(s[i]);
else s[i] = ' ';
}
stringstream ss(s);
while(ss >> buf) dict.insert(buf);
}
for (set<string>::iterator it = dict.begin(); it != dict.end(); it++)
cout << *it << endl;
return ;
}
安迪的第一个字典(UVa10815)的更多相关文章
- 5_3 安迪的第一个字典(UVa10815)<set的使用>
Andy 是个 8 岁的孩子,他梦想要制作一本他自己的字典. 这并不是一件容易的事,因为他认识的字还不是那么多. 他并不想要自己去想这本字典中该放哪些字,他有个聪明的主意. 就是拿出他最喜欢的一本故事 ...
- 安迪的第一个字典 (Andy's First Dictionary,UVa10815)
题目描述: #include<iostream> #include<string> #include<set> #include<sstream> us ...
- UVa 10815 安迪的第一个字典
https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...
- stl的集合set——安迪的第一个字典(摘)
set就是数学上的集合——每个元素最多只出现一次,和sort一样,自定义类型也可以构造set,但同样必须定义“小于”运算符 以下代码测试set中无重复元素 #include<iostream&g ...
- 安迪的第一个字典(Andy's First Dictionary,UVa 10815)
Description Andy, , has a dream - he wants to produce his very own dictionary. This is not an easy t ...
- STL语法——集合:set 安迪的第一个字典(Andy's First Dictionary,UVa 10815)
Description Andy, , has a dream - he wants to produce his very own dictionary. This is not an easy t ...
- 安迪的第一个字典(Andy's First Dictionary,Uva 10815)
输入一个文本,找出所有不同的单词(连续的字母序列),按字典序从小到大输出.单 词不区分大小写. 样例输入: Adventures in Disneyland Two blondes were goin ...
- [STL] UVA 10815 安迪的第一个字典 Andy's First Dictionary
1.set 集合 哦....对了,set有自动按照字典序排序功能..... 声明和插入操作 #include <cstdio> #include <vector> #inclu ...
- set的运用 例题5-3 安迪的第一个字典(Andy's First Dictionary,Uva 10815)
#include<bits/stdc++.h>using namespace std;set<string> dict;int main(){ string s, buf; w ...
随机推荐
- YII2 model where 条件拼接
熟悉Yii2的查询条件后,用Active Record查询数据非常方便. 以下我们介绍where()方法当中,条件的拼装方式. #某个值为null,会用IS NULL来生成语句: ['type' =& ...
- 【cdq分治】【CF1093E】 Intersection of Permutations
传送门 果然前两天写完咕咕咕那个题的题解以后博客就开始咕咕咕了-- Description 给定整数 \(n\) 和两个 \(1~\sim~n\) 的排列 \(A,B\). \(m\) 个操作,操作有 ...
- FreeRTOSv9.0.0在STM32F103RCT6上的移植
1.去官网下载源代码(FreeRTOSv9.0.0.exe) 2.取出Source文件夹,根据单片机和编译器不同,删除不需要的文件,如下图 3.在CORTEX_STM32F103_IAR文件夹中取出P ...
- 删除docker网络docker0
yum -y install bridge-utils ifconfig docker0 down brctl delbr docker0
- VisualSVN 5.1.4破解
1. 备份visualSVNbin目录 2. 打开VS命令提示工具,反编译VisualSVN.Core.L.dll 运行命令 ildasam "VisualSVN安装目录\bin\Visua ...
- Android 加载网络图片设置到ImageView
下载图片后显示在ImageView中 //1.定义全局变量 private Handler handler; private String image_url; private Bitmap bitm ...
- Codeforces 221 D. Little Elephant and Array
D. Little Elephant and Array time limit per test 4 seconds memory limit per test 256 megabytes input ...
- zoj 3229 Shoot the Bullet(有源汇上下界最大流)
Shoot the Bullethttp://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=3442 Time Limit: 2 Second ...
- HDU 2685 GCD推导
求$(a^n-1,a^m-1) \mod k$,自己手推,或者直接引用结论$(a^n-1,a^m-1) \equiv a^{(n,m)}-1 \mod k$ /** @Date : 2017-09-2 ...
- MongoDB - MongoDB CRUD Operations, Insert Documents
MongoDB provides the following methods for inserting documents into a collection: db.collection.inse ...