安迪的第一个字典(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 ...
随机推荐
- 流媒体协议之RTP详解20170921
1.RTP介绍 实时传输协议RTP(Real-time Transport Protocol)是一个网络传输协议,它是由IETF的多媒体传输工作小组1996年在RFC 1889中公布的,后在RFC35 ...
- Educational Codeforces Round 20 C 数学/贪心/构造
C. Maximal GCD time limit per test 1 second memory limit per test 256 megabytes input standard input ...
- 跟我一起写Makefile(七)
make 的运行—————— 一般来说,最简单的就是直接在命令行下输入make命令,make命令会找当前目录的makefile来执行,一切都是自动的.但也有时你也许只想让make重编译某些文件,而不是 ...
- java类的静态属性值获取
获取某个类实例的静态属性: public class ErrorCode { private String code; private String message; private ErrorCod ...
- NOIP模拟赛10
T1 [HAOI2010]软件安装 https://daniu.luogu.org/problem/show?pid=2515 树上背包,如果有i必须有j,j作为i的父节点 O(nm²) #inclu ...
- 图论:DFS序
DFS序可以把树转到区间上再用高级数据结构维护,比树链剖分好理解很多 一个闭区间就是一棵子树 POJ3321 #include<cstdio> ; ; int n,m,id,cnt; in ...
- windows安装zookeeper和kafka,flume
一.安装JDK 过程比较简单,这里不做说明. 最后打开cmd输入如下内容,表示安装成功 二.安装zooeleeper 下载安装包:http://zookeeper.apache.org/release ...
- FastDFS图片服务器java后台的简单调用
工具类: package com.liveyc.common.fdfs; import org.apache.commons.io.FilenameUtils; import org.csource. ...
- Openflow Plugin学习笔记2
OpenDaylight OpenFlow Plugin 过载保护 过载保护 OF Plugin中的过载保护按如下流程工作: ConnectionConductor将消息送入队列,是最靠近OFJava ...
- Thinkphp的CURD
CURD即(Create Update Read Delete)其实也就是等同于增删改查. C:Create 创建数据 对数据的添加 Create$m=new Model('User');$m=M( ...