UVA 10815 - Andy's First Dictionary(字符串)

Visio 2013安装遇阻?手把手教你搞定注册表权限错误1402(附64位系统特殊处理) 本文详细解析了Visio 2013安装过程中常见的注册表权限错误1402问题,特别是在64位系统下的特殊处理方法。通过分步指导如何修改注册表权限、处理Wow6432Node分支以及使用高级工具如subinacl,帮助用户顺利完成安装并避免常见连带问题。 阅读详情

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


Joke and image taken from the Web

=================================

给出几个句子,把句子中出现的所有单词按字母表排序,可能有重复出现的单词只记一遍


开始用sort排序怎么也排不了,于是各种查题解学会用qsort了orz

依然是按字符处理赋给二维数组s,遇到不是字母的就变成 "\0" 然后与已经存好的s比较,有相同的就a--不存这个单词,全部输入完成之后用qsort排序输出


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

char s[5111][111];

int cmp(const void *a,const void *b)
{
    return strcmp((char*)a,(char*)b);
}

int main()
{
    int a=0,j=0;char c;
    memset(s,0,sizeof(s));
    while((c=getchar())!=EOF)
    {
        if(c>='A'&&c<='Z')
        {
            s[a][j++]=(c+'a'-'A');
        }
        else if(c>='a'&&c<='z')
        {
            s[a][j++]=c;
        }
        else if(j)//这里没写if(j)WA了,大概是最后会多一个空字符?
        {
            s[a][j]='\0';
            j=0;
            a++;
            for(int i=0;i<a-1;i++)
            {
                if(strcmp(s[i],s[a-1])==0)
                {
                    a--;
                    break;
                }
            }
        }
    }
    qsort(s,a,sizeof(s[0]),cmp);
    for(int i=0;i<a;i++)
        cout<<s[i]<<endl;
    return 0;
}


基于LORA的双机通信的智能农业系统 通过LoRa模块与主机进行通信,监测环境中的温度、湿度、土壤湿度和光照强度等参数,并根据预设的自动控制逻辑或者手动指令控制继电器开关,从而调节风扇、加热器、水泵、喷雾器和灯光等设备,为植物提供适宜的生长环境。使用的Lora是大夏龙雀的感觉这个是我使用过的Lora里面最好用的,因为不用设置频道就可以直接透明传输,使用起来得心应手。就像两个单片机直接串口通信一样,缺点是异步串行,不能同时进行接收和发送。继电器灯亮模拟打开对应的风扇、水泵、灯、喷雾、加热。1.使用温度传感器测当前环境的温湿度。 阅读详情

相关推荐

从报错到定位:Memtest86 DQ位算法解析与实践指南

本文深入解析了Memtest86内存测试工具报错信息的解读方法,重点介绍了通过地址解析、数据转换、位比对和DQ定位四步算法,精准锁定故障DQ位的实践流程。文章以DDR4和DDR5为例,详细拆解了从十六进制报错到二进制比对的完整步骤,并提供了从单个报错分析到故障模式诊断的进阶指南,帮助用户将抽象的报错信息转化为具体的维修或排查依据。

sre5engineer的博客 486

UVA10815 Andy's First Dictionary【set+字符串切割】

问题链接: UVA10815 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, as the number of words that he knows is, well, not quite e...

aaaaawyf的博客 217

Cadence 17.2配置CIS数据库报错?手把手解决ODBC驱动位数不匹配问题

本文详细解析了Cadence 17.2配置CIS数据库时常见的ODBC驱动位数不匹配问题,提供了从系统环境检查到分步解决方案的完整指南。重点解决32位应用程序与64位ODBC驱动之间的架构冲突,包含驱动安装、DSN配置及高级排查技巧,帮助电子工程师快速恢复设计环境。

play7的博客 970

uva10815 Andy's First Dictionary(字符串的简单处理)

题目戳这里题意: 按字典序输出文字段落中出现过的所有单词,出现多次记为一次。思路: 1.大写换小写。 2.过滤字母以外字符,生成多个单词,将单词插入到set容器中。 3.使用set容器按字典序自动生成所需答案。ac代码:/* *Author : Flint_x *Created Time : 2015-04-04 17:02:48 *File name : uva10815.cpp *

a novice 625

零基础搭建机械零件检测系统:基于YOLOv8的PySide6可视化开发全攻略

本文详细介绍了如何从零开始搭建基于YOLOv8的机械零件检测系统,涵盖环境配置、数据集准备、模型训练优化及PySide6可视化界面开发全流程。通过实战案例展示YOLOv8在工业检测中的高效应用,帮助开发者快速实现自动化零件检测解决方案。

weixin_28455801的博客 309

EB tresos配置指南:CAN通信信号收发全流程解析

本文详细解析了使用EB tresos配置工具实现AUTOSAR架构下CAN通信信号收发功能的全流程。从环境准备、COM模块信号定义、PduR路由配置、CanIf硬件抽象到CAN驱动层设置,提供了清晰的步骤指南和关键配置要点,帮助开发者快速打通从应用层到物理层的数据链路,实现可靠的CAN通信。

weixin_29192141的博客 508

uva 10815 Andy's First Dictionary(字符串处理+sort排序)

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

不慌不忙、不急不躁 2243

CLAHE 算法学习 matlab

概念可参考: CLAHE (Contrast Limited Adaptive Histogram Equalization)算法学习CLAHE具体实现主要包括6个步骤。1):分块。将输入图像划分为大小相等的不重叠子块,每个子块含有的像素数为M。参考示例为8×8块。 2):计算子块直方图。 3):计算剪切阈值clipLimit 4):像素点重分配。对每个子块,使用步骤三中多余的像素重新分配。 5):直方图均衡。 6):像素点灰度值重构。(源码中采用了双线性插值) http://www.realtimer

baidu_34971492的博客 4253

UVA10815 Andy's First Dictionary(字符串处理)

Description HH学长刚刚立下了再不过CET就直播xx的flag,为了不真的开启直播模式,HH学长决定好好学习英语。于是他每天都读一篇只包含生词的英语文章,并以自己高达450的智商在一秒钟之内记忆下来。 现在给你一篇HH学长今天要读的文章,请你写一个程序,输出他都学习到了哪些单词。 要求:如果文章中有相同的单词,那么仅仅输出一次;而且如果两个单词只有大小写不同,将他们视为相同的单词。 I...

在读NLP硕士 294

RK3588 部署 YOLO26-Pose 人体姿态检测:Windows Docker 环境全流程

YOLO26-Pose 在 RK3588 上的部署流程是 PC 端 ONNX 导出 → RKNN 转换(INT8 量化)→ 板端推理。INT8 量化后 YOLO26s-Pose 约 35ms,YOLO26n-Pose 约 15ms,可以覆盖实时姿态检测的需求。后处理是 Python 实现的常见瓶颈——如果帧率不达标,先用 npy 保存模型输出在 PC 上验证解析逻辑的正确性,确认无误后再迁移到 C++ 实现。

m0_64661770的博客 543

计算图像哈希SHA-512

上述需要将lena.jpg放在当前目录下。

计算机视觉之光 961

UVA10815 Andy's First Dictionary【字符串处理】

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

逐梦者 337

基于STM32L4XX 、HAL库的ATD5984步进电机驱动器驱动程序应用设计

一、简介: ATD5984是一款内部集成了译码器的微特步进电机 驱动器,能使双极步进电机以全、半、1/4、/1/8、1/16 和1/32步进模式工作。步进模式由逻辑输入管脚MSx选 择。其输出驱动能力达到28V±1.6A。 译码器是ATD5984易于使用的关键,通过STEP管脚 输入一个脉冲就可以使电机完成一次步进,省去了相序 表,高频控制线及复杂的编程接口,使其更适于没有复 杂的微处理器或微处理器负担过重的场合。 在步进操作期间,ATD5984的内部电路可以自动

PP_Cottage的博客 406

UVa10815_Andy's First Dictionary(小白书字符串专题)

解题报告 思路: 字典树应用,dfs回溯遍历字典树 #include #include #include using namespace std; struct node { int v; node *next[26]; }; int l,m,cnt; char str[100],ch[100],dic[5500][100]; node *newnode() {

_nplus 1242

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

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

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

UVa 10815 Andy's First Dictionary (分离字符串)

10815 - Andy's First Dictionary Time limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=96&page=show_problem&problem=1756 Andy, 8, has a dream -

AC,∑ndless 1744

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

UVA10815 Andy's First Dictionary(字符串)

题目: 题目: 字符串处理,直接看代码吧 代码: #include #include #include #include #include #include #include #include #include #include #define mem(a,b) memset(a,b,sizeof(a)) #define N 330 #define M 1000

riba2534的博客 564

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

UVA 10815 — Andy's First Dictionary(强大的字符串流)

题目大意:给你一串字符串,包含空格,标点,字母。让你把所有的单词(连续的字母)处理出来,然后按字典序输出。 例如: Adventures in Disneyland Two blondes were going to Disneyland when they came to a fork in the road. The sign read:

cysjiang的博客 411

uva 10815 Andy's First Dictionary(字符串排序)

题意是找出一串字符串里面的单词

渐近自由 574

uva 10815 - Andy's First Dictionary(快排、字符串)

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1756 View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<c...

weixin_33895604的博客 77

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

例题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

UVa OJ 10815-Andy's First Dictionary

<br /> <br />简单统计+快排:<br />{ Author:wzx961008 Problem:UVa 10815-Andy's First Dictionary Verdict:Accepted Language:PASCAL Run Time:0.528s Submission Date:2011-01-14 12:43:12 } var dict:array[1..5001]of string; num,i:longint; t:boole

Chiwin 600

字符串训练 ----- UVA 10815题目Andy's First Dictionary

解题思路: 本题主要是涉及分割获取单词  然后按字典排序输出单词 (这个只要用qsort排序下就好了) AC代码如下 #include #include #include using namespace std; // 解题思路: 将输入的数据全部转换为小写 // 从字符串中识别出单词 // 写排序算法 如果有相同的 则后面的相同字符串换成"" st

Aleks 745

UVA ~ 10815 ~ Andy's First Dictionary(set+字符串处理)

题意:现在给你一篇XY学长今天要读的文章,请你写一个程序,输出他都学习到了哪些单词。要求:如果文章中有相同的单词,那么仅仅输出一次;而且如果两个单词只有大小写不同,将他们视为相同的单词。输入一篇文章每组数据以EOF结束。 思路:用set存单词,先把所有非字母的字符转化为空格,然后用stringstream得到每个单词。 #include using namespace std; int mai

张松超的博客 455

UVA 10815 (暑假-字符串(2) -D - Andy's First Dictionary)

#include #include #include int cmp_string(const void *a, const void *b) { return strcmp((char *)a, (char *)b); } int main() { char str[210], word[150010][50] = {0}; int n; int count = 0; whi

Bingo 1821

UVa10815 - Andy's First Dictionary- 字符串(map的使用)-难度2

题目链接: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1756 Problem B: Andy's First Dictionary Time limit: 3 seconds

Ieyasu的专栏 677
上一篇: UVA 10878 - Decode the tape(字符串)
下一篇: UVA 644 - Immediate Decodability(字符串)
coco430
博客等级 码龄14年 9粉丝 107原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值