UVA 10815 Andy's First Dictionary ---set
题意:输入一个文本,找出所有不同的单词(连续的字母序列),按字典序从小到大输出。单词不区分大小写。
刘汝佳算法竞赛入门经典(第二版)P112
#include <iostream>
#include <string>
#include <set>
#include <sstream>
using namespace std;
set<string> dict;//string集合
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 ;
}
UVA 10815 Andy's First Dictionary ---set的更多相关文章
- UVa 10815 Andy's First Dictionary
感觉这道题要比之前几个字符串处理的题目难度要大了一些. 题目大意:给若干行字符串,提取出所有单词并去掉重复的,最后按字典顺序输出. 对于输入大致有两种思路,一种是逐个读入字符,遇到字母的话就放到wor ...
- UVA - 10815 - Andy's First Dictionary STL
Andy, 8, has a dream - he wants to produce his very own dictionary. This is not an easy task for him ...
- UVA 10815 Andy's First Dictionary (C++ STL map && set )
原题链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_proble ...
- UVA 10815 Andy's First Dictionary【set】
题目链接:https://vjudge.net/contest/211547#problem/C 题目大意: 输入一个文本,找出所有不同的单词(连续的字母序列),按字典序从小到大输出,单词不区分大小写 ...
- Uva 10815 Andy's First Dictionary(字符串)
题目链接:https://vjudge.net/problem/UVA-10815 题意 找出一段文本中的所有单词,以小写形式按照字典序输出. 思路 用空白符替换文本中所有非字母字符后再次读入. 代码 ...
- UVA 10815 Andy's First Dictionary(字符处理)
Andy, 8, has a dream - he wants to produce his very own dictionary. This is not an easy task for him ...
- UVa10815.Andy's First Dictionary
题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...
- UVA-10815 Andy's First Dictionary (非原创)
10815 - Andy's First Dictionary Time limit: 3.000 seconds Problem B: Andy's First DictionaryTime lim ...
- 【UVA - 10815】Andy's First Dictionary (set)
Andy's First Dictionary Description 不提英文了 直接上中文大意吧 XY学长刚刚立下了再不过CET就直播xx的flag,为了不真的开启直播模式,XY学长决定好好学习英 ...
随机推荐
- nyoj 364 田忌赛马(贪心)
田忌赛马 时间限制:3000 ms | 内存限制:65535 KB 难度:3 描述 Here is a famous story in Chinese history. "That ...
- xcode7 NSAppTransportSecurity
在Info.plist中添加 NSAppTransportSecurity 类型 Dictionary Dictionary 下添加 NSAllowsArbitraryLoads 类型 Bool ...
- MVC后台传dt数据
//MVC后台传dt数据 public JsonResult TeacherVoteInfo([FromBody]Teacher_VoteModel model) { string tname = m ...
- eclipse svn
1.上传初始项目在百度云上面创建一个空版本,然后右击项目->team->shareProject在svn的url后面加上你的版本号(否则上传失败) 2.把服务器上的项目更新到自己的项目wi ...
- [hihoCoder#1065]全图传送
[hihoCoder#1065]全图传送 试题描述 先知法里奥是 Dota 系列中的一个英雄.机动性强,推塔能力一流,打钱速度快,传送技能使先知可以全地图支援.在后期比拼中通过强大的兵线控制能力使得对 ...
- JavaScript判断是否是手机mobile登录
在页面代码中加入以下js,即可利用JavaScript判断是否是手机mobile登录! <script type="text/javascript" src="${ ...
- ACM - a + b Problem
前几天看了ACM的第一题,映入眼帘的是一个“简单”的题目: 输入两个数,a,b 输出他们的和. 本着,此乃ACM的原则,便有了如下的思考: ACM的题目肯定很难,a+b,怎么可能直接printf,不行 ...
- eclipse中整合springMvc和velocity
1.项目所需要的jar包(有些可能多余) 2.在src目录下创建一个bean 一个一个controller ,路径如下 person代码: package com.test.bean; import ...
- java检测文件内是否包含指定内容
package com.test; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.File ...
- php构造函数和析构函数
构造函数 void __construct ([ mixed $args [, $... ]] ) PHP 5 允行开发者在一个类中定义一个方法作为构造函数.具有构造函数的类会在每次创建新对象时先调用 ...