题目链接

题意:输入一个文本,找出所有不同的单词(连续的字母序列),按字典序从小到大输出。单词不区分大小写。

刘汝佳算法竞赛入门经典(第二版)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的更多相关文章

  1. UVa 10815 Andy's First Dictionary

    感觉这道题要比之前几个字符串处理的题目难度要大了一些. 题目大意:给若干行字符串,提取出所有单词并去掉重复的,最后按字典顺序输出. 对于输入大致有两种思路,一种是逐个读入字符,遇到字母的话就放到wor ...

  2. 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 ...

  3. UVA 10815 Andy's First Dictionary (C++ STL map && set )

    原题链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_proble ...

  4. UVA 10815 Andy's First Dictionary【set】

    题目链接:https://vjudge.net/contest/211547#problem/C 题目大意: 输入一个文本,找出所有不同的单词(连续的字母序列),按字典序从小到大输出,单词不区分大小写 ...

  5. Uva 10815 Andy's First Dictionary(字符串)

    题目链接:https://vjudge.net/problem/UVA-10815 题意 找出一段文本中的所有单词,以小写形式按照字典序输出. 思路 用空白符替换文本中所有非字母字符后再次读入. 代码 ...

  6. UVA 10815 Andy&#39;s First Dictionary(字符处理)

    Andy, 8, has a dream - he wants to produce his very own dictionary. This is not an easy task for him ...

  7. UVa10815.Andy's First Dictionary

    题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...

  8. UVA-10815 Andy's First Dictionary (非原创)

    10815 - Andy's First Dictionary Time limit: 3.000 seconds Problem B: Andy's First DictionaryTime lim ...

  9. 【UVA - 10815】Andy's First Dictionary (set)

    Andy's First Dictionary Description 不提英文了 直接上中文大意吧 XY学长刚刚立下了再不过CET就直播xx的flag,为了不真的开启直播模式,XY学长决定好好学习英 ...

随机推荐

  1. log4net的基本配置及用法

    [1].[代码] [C#]代码 跳至 [1] [2] ? 1 2 using System.Reflection;  //使用反射 static private ILog log = log4net. ...

  2. IE打开报错,提示该内存不能为read的解决办法!

    由于最近我遇到过一次浏览器打不开的情况,出错的错误提示为 浏览器错误:“0x5ddfddac”指令引用的“0x00000020”内存,该内存不能为read经过杀毒及IE修复均不能解决!(没试过360急 ...

  3. MySQL监控系统MySQL MTOP的搭建(转VIII)

    MySQLMTOP是一个由Python+PHP开发的MySQL企业级监控系统.系统由Python实现多进程数据采集和告警,PHP实现WEB展示和管理.最重要是MySQL服务器无需安装任何Agent,只 ...

  4. 第一天 django

    全栈增长工程师实战 http://growth-in-action.phodal.com/ 生成的代码和示例不一样,static 也要加上 from django.conf.urls import u ...

  5. mysql-mysql悲观锁和乐观锁

    1.mysql的四种事务隔离级别 I. 对于同时运行多个事务,当这些事务访问数据库中的相同数据时,如果没有采取必要的隔离机制,就会导致各种并发问题. (1)脏读: 对于两个事物 T1, T2, T1 ...

  6. NOIP“对偶”题:还教室

    先说一下思路: 方差可以经过恒等变形变成 x12 + x22 + ... + xn2 + 2a(x1 + x2 + ... + xn) + na2 所以维护平方和.连续和即可 平均数我就不再推了…… ...

  7. Service

      一.什么是Service Service在后台运行,不与用户进行交互.在默认情况下,Service运行在应用程序进程的主线程中,如果需要在Service中处理一些网络连接等耗时的操作,那么应该将这 ...

  8. JavaScript基础介绍

    JavaScript组成 •ECMAScript:解释器.翻译 •DOM:Document Object Model •BOM:Browser Object Model –各组成部分的兼容性,兼容性问 ...

  9. OpenMP求完数

    源代码: #include "stdafx.h" //必须写在首行,因为其前面的include都会被忽略 #include "omp.h" #include & ...

  10. ASP.NET MVC Dropdownlist

    本文介绍如何在网页里显示DropDownList. Step 1: 在Control里面添加方法 public ActionResult ShowDropDownList() { return Vie ...