Uva 10815-Andy's First Dictionary(串)

每日算法6 —— UVa10815 安迪的第一个字典 Andy‘s First Dictionary 每日算法6 —— UVa10815 安迪的第一个字典 Andy's First Dictionary 阅读详情

Problem B: Andy's First Dictionary

Time limit: 3 seconds


Andy, 8, has a dream - he wants to produce his very own dictionary. This is not an easy task for him, as the number of words that he knows is, well, not quite enough. Instead of thinking up all the words himself, he has a briliant idea. From his bookshelf he would pick one of his favourite story books, from which he would copy out all the distinct words. By arranging the words in alphabetical order, he is done! Of course, it is a really time-consuming job, and this is where a computer program is helpful.

You are asked to write a program that lists all the different words in the input text. In this problem, a word is defined as a consecutive sequence of alphabets, in upper and/or lower case. Words with only one letter are also to be considered. Furthermore, your program must be CaSe InSeNsItIvE. For example, words like "Apple", "apple" or "APPLE" must be considered the same.

Input

The input file is a text with no more than 5000 lines. An input line has at most 200 characters. Input is terminated by EOF.

Output

Your output should give a list of different words that appears in the input text, one in a line. The words should all be in lower case, sorted in alphabetical order. You can be sure that he number of distinct words in the text does not exceed 5000.

Sample Input

Adventures in Disneyland

Two blondes were going to Disneyland when they came to a fork in the
road. The sign read: "Disneyland Left."

So they went home.

Sample Output

a
adventures
blondes
came
disneyland
fork
going
home
in
left
read
road
sign
so
the
they
to
two
went
were
when
给一篇文章。。然后生成一个字典。按字典序输出。。set乱搞
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cctype>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#define ll long long
#define maxn 360
#define pp pair<int,int>
#define INF 0x3f3f3f3f
#define max(x,y) ( ((x) > (y)) ? (x) : (y) )
#define min(x,y) ( ((x) > (y)) ? (y) : (x) )
using namespace std;
char t[210],tem[210];
int main()
{
	set <string> s;
	while (gets(t))
	{
		int len=strlen(t),p;
		for(int i=0;i<=len;)
		{
			if(isalpha(t[i]))
			{
				p=0;
				tem[p++]=tolower(t[i]);
				i++;
				while(isalpha(t[i]))
				tem[p++]=tolower(t[i++]);
				tem[p++]='\0';string x(tem);s.insert(x);
			}
			else
			i++;
		}
	}
	set <string>::iterator it=s.begin();
	while(it!=s.end())
	{
		cout<<*it<<endl;
		it++;
	}
	return 0;
}
【转载】参数估计(Parameter Estimation):频率学派(最大似然估计MLE、最大后验估计MAP)与贝叶斯学派(贝叶斯估计BPE) 基础 频率学派与贝叶斯学派 http://www.douban.com/group/topic/16719644/ http://www.zhihu.com/question/20587681 最大似然估计(Maximum likelihood estimation,MLE) http://baike.baidu.com/view/1918804.htm http://baike.baidu.co 阅读详情

相关推荐

从UART到RS485:手把手教你用SIT3485E收发器搞定工业级通信(含原理图与PCB布局要点)

本文详细解析了从UART到RS485的工业级通信转换,重点介绍了SIT3485E收发器的原理图设计、PCB布局要点及抗干扰技巧。通过差分信号传输和优化电路设计,实现长距离、多设备稳定通信,适用于工业自动化等复杂环境。

weixin_29169505的博客 349

STL之set集合(C++)

文章目录1、set是一个关联式容器(1)关于关联式容器(2)元素唯一性(3)底层实现——红黑树2、set的常用方法(1)注意(2)用法示例 1、set是一个关联式容器  set 需声明头文件 #include <set> (1)关于关联式容器     STL容器大的方向分为两类,序列式容器 和 关联式容器,这两者通过数据在容器内的排列来区分,关联容器 是通过 键(key) 存储和读取元素的,而 顺序容器 则通过元素在容器中的 位置顺序 存储和访问元素。标准的STL序列容器包括:vector、li

阿怪的博客 1348

【Isaac Sim】无头服务器远程桌面连接实战:Turbovnc配置与常见问题解决

本文详细介绍了在无头GPU服务器上通过Turbovnc远程桌面连接并运行NVIDIA Isaac Sim的实战教程。针对无图形界面服务器运行仿真软件的核心痛点,文章提供了从Turbovnc安装配置、SSH隧道建立,到以普通用户身份启动服务、解决GLXBadFBConfig等常见图形错误的完整方案,帮助开发者在云端高效部署机器人仿真环境。

weixin_29254673的博客 773

C++随手记(比C丰富的内容,大部分在STL库中,支持C++11)转载知识点合集

针对有语言基础但对头文件和一些对竞赛(ACM、NOIP、ICPC)刚有初步了解的蒟蒻

wangyubo_20040617的博客 827

macOS 12.7.6部署Ollama+Dify避坑指南

本文介绍了在macOS 12.7.6系统下部署Ollama和Dify的详细步骤及避坑指南。主要内容包括:1)关闭系统完整性保护(SIP)以允许修改系统目录;2)安装特定版本的Docker(2.1.0.5)和docker-compose(v2.38.2)以避免兼容性问题;3)配置Ollama服务并下载nomic-embed-text和deepseek-r1:7b模型;4)针对macOS调整Dify的docker配置文件,包括延长超时时间、修改存储路径、增加资源限制等关键设置。文中提供了完整的命令操作步骤和配置

Hi20240217的博客 3103

昇腾910B+MindIE部署Qwen模型避坑指南:从镜像下载到推理测试全流程

本文详细介绍了在昇腾910B硬件环境中使用MindIE推理工具部署Qwen系列模型的全流程指南。从环境准备、镜像下载到模型部署与性能优化,提供一站式解决方案,帮助开发者高效完成AI模型推理任务。

weixin_29219189的博客 766

第五章 C++与STL入门(例题篇:STL部分)--算法竞赛入门经典

第五章 C++与STL入门(例题篇:STL部分) 例题5-1:大理石在哪儿(UVa10474) P108 排序与检索 #include<cstdio> #include<algorithm> using namespace std; const int maxn = 10000; int main() { /*ios::sync_with_stdio(false);*/ ...

BooleanWater的博客 950

超详细 | 贝叶斯网络基础——有图有真相

Hello,大家好,我是starz。这是本系列的第二篇《概率基础Ⅱ》,虽说是概率基础,但作为过渡,它开始以图为载体 这节的主要内容有: 贝叶斯网络 三种结构 D-划分 贝叶斯球 马尔科夫毯 应用例子 总结 让我们开始吧 :3 贝叶斯网络 概率图模型可笼统分为两类,一是基于无向图的马尔科夫网络: 二是基于有向图的贝叶斯...

qq_41603411的博客 2万+

安迪的第一个字典(Andy‘s First Dictionary,Uva 10815)

安迪的第一个字典 问题描述 输入一个文本,找出所有不同的单词(连续的字母序列),按字典序从小到大输出。单词不区分大小写。 样例输入 Adventures in Disneyland Two blondes were going to Disneyland when they came to a fork in the road. The sign read: “Disneyland Left.” So they went home. 样例输出 a adventures blondes came d

qq_54233803的博客 612

解决k8s核心组件calico pod资源不创建问题

解决k8s核心组件calico pod资源不创建问题 1.问题描述 由于K8S集群Master节点故障,导致calico网络组件虽然处于Running状态,但是一直无法准备就绪,如下图所示 calico-node-lpt7h运行在master节点,第一时间紧急处理方法就是将其pod删除,让K8S自动重建该pod,使整个集群快速恢复 但是就当我将calico-node-lpt7h pod删除后,该pod始终无法自建,就好像是从来没有这个pod似的 2.解决方法 期初排查时,我觉得可能是由于当前master

江晓龙的博客 4807

Unity零基础到入门☀️| 万字教程 讲解Unity中的数据存储 PlayerPrefs、XML、JSON【建议收藏】

本文章是Unity零基础到入门专栏的系列文章。 适合对Unity3D引擎感兴趣的小伙伴学习,偏向于新手学习! 本篇文章就来介绍一下Unity中三种基本的数据存储方式:PlayerPrefs、XML、JSON

努力前行,总会成为自己心中的那道光 8万+

《STL》— UVa10815 Andy's First Dictionary

UVa10815 Andy's First Dictionary 题意:输入一个文本,找出所有不同的单词(连续字母序列),按字典序从小到大输出。单词不分大小写。 #include<string> #include<set> #include<sstream> #include<iostream> using namespace std;...

69小石头的博客 707

OpenHarmony之Histreamer引擎深度解析:pipeline_core架构如何全面取代GStreamer,一统音视频播放与录制

Histreamer是OpenHarmony多媒体框架的核心媒体引擎,采用架构设计。一个轻量级的媒体引擎组件,提供播放、录制等场景的媒体数据流水线处理。1.播放场景分为如下几个节点:数据源读取、解封装、解码、输出;2.录制场景分为如下几个节点:数据源读取、编码、封装、输出。该引擎从OH5.0开始取代了原有的媒体引擎gstreamer(部分文档还保留较老架构的讲解),提供统一的音视频播放、录制、元数据解析等能力。

m0_67505153的博客 332

UVa10815.Andy's First Dictionary

题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1756 13913607 10815 Andy's First Dictionary Accepted C++ 0.058 2014...

banxuanliu0005的博客 115

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

Andy's First Dictionary UVA - 10815

Andy's First Dictionary 题目链接 这道题的要求将所有出现的单词按照顺序输出,完全符合set去重并且自动排序的功能,我们就可以选择用set进行代码实现。 在进行样例测试的时候可能会有问题,回车总是代表一个字符串的结束标记符,在这里我们要进行多组输入,所以我们在输入未知的多组字符串后要结束多组输入,及使该输入达到end of file时结束多组输入,Crtl+z即代表EO...

双木林的博客 338

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

例题5-3 UVA10815 Andy's First Dictionary(17行AC代码)

紫书刷题进行中,题解系列【GitHub|优快云】 例题5-3 UVA10815 Andy’s First Dictionary(17行AC代码) 思路分析 给定若干行字符串,按字典序输出不重复的单词 字典序排列和去重:定义set<string> dict; 存储词典,自动去重且按字典序排列 可用getline读入每一行,将其字母均转为小写,非字母转为空格,拼接文本 可用stri...

努力做个书呆儿 258

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

UVA-10815 Andy's First Dictionary

UVA-10815 Andy’s First Dictionary题目大意:输入几段话,把其中的单词按字母表顺序输出出来,除去重复的。Sample Input Adventures in Disneyland Two blondes were going to Disneyland when they came to a fork in the road. The sign read: “Dis

Tochase的博客 220

Andy's First Dictionary, UVa 10815

Andy’s First Dictionary, UVa 10815 //Andy’s First Dictionary, UVa 10815 //输入一个文本,找出所有不同的单词(连续的字母序列) //按字典序从小到大输出,单词不区分大小写。 #include <iostream> #include <set> #include <string> #inclu...

恒治学 136

UVa 10815 Andy's First Dictionary 【set】【字典序】

UVa 10815 安迪上天想要做字典 Andy, 8, has a dream - he wants to produce his very own dictionary. This is not an easy task for him, as the number of words that he knows is,well, not quite enough. Instead of thi

卡西莫多 364

UVA 10815 Andy's First Dictionary

UVA 10815 Andy's First Dictionary 字符串水题,有几个WA点要注意。  1、题目说是最多5000个单词,但是是去重以后的,所以实际要开数组更大。 2、题目中有空行。在输出的时候忽略这些空行。 #include #include #include #include using namespace std; char map[101000][

Remilia's 965

UVA 10815-Andy's First Dictionary

UVA 10815-Andy’s First Dictionary题目大意:输入几条句子,找出单词,并以字典序排序解题思路:用qsort()排序#include <stdio.h> #include <string.h> #include <iostream> using namespace std; int cmp(const void *a,const void *b) { return

ZeroLH00的博客 614

例题5-3 安迪的第一个字典(Andy's First Dictionary,UVa 10815)

原题链接:https://vjudge.net/problem/UVA-10815 分类:<set> 备注:set的使用 前言:在这里第一次看到STL的迭代器。 注意:题目可能一次性输入多个单词但是间隔这些单词的不是空格而是其它字符。 代码如下: #include<iostream> #include<sstream> #include<string&gt...

TK_wang_的博客 355

Andy's First Dictionary ——Uva 10815

Andy, 8, has a dream - he wants to produce hisvery own dictionary. This is not an easy task forhim, as the number of words that he knows is,well, not quite enough. Instead of thinking up allthe words ...

yane的博客 277

Andy's First Dictionary

题目见uva 10815 意思是将一段话中的所有不同单词转化为小写按字典序输出。 注意We’re good friend! 输出结果应该是: friend good re we 被空格符号等分割的看做两个单词。 利用set中string已经重载了&lt;,将所有单词插入set容器输出即可。 #include&lt;iostream&gt; #include&lt;cstring&gt; #incl...

qq_40486952的博客 285

题解 Andy s First Dictionary(UVa10815)紫书P112set的应用

紫书P112;set的应用;Andy’s First Dictionary(UVa10815); Vjudge题目地址请移步此处 题目大意: 输入一个文本(最多500行,每行最多200个字符,以EOF结尾),找出所有不同的单词,按照字典序从小到大输出以小写输出(一行一单词)。 Sample Input Adventures in Disneyland Two blondes were going to Disneyland when they came to a fork in the road. The

Love_Jacques的博客 472
上一篇: POJ 2531-Network Saboteur(DFS)
下一篇: Uva 409-Excuses, Excuses!(串)
_lyl
博客等级 码龄12年 263粉丝 421原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值