博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
UVA 10815 Andy's First Dictionary(字符处理)
阅读量:5105 次
发布时间:2019-06-13

本文共 2191 字,大约阅读时间需要 7 分钟。

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.

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.

Adventures in DisneylandTwo blondes were going to Disneyland when they came to a fork in theroad. The sign read: "Disneyland Left."So they went home.

aadventuresblondescamedisneylandforkgoinghomeinleftreadroadsignsothetheytotwowentwerewhen
构造一个不反复的字典。

map一下就可以。

(大写和小写)

#include
#include
#include
#include
#include
typedef long long LL;using namespace std;#define REPF( i , a , b ) for ( int i = a ; i <= b ; ++ i )#define REP( i , n ) for ( int i = 0 ; i < n ; ++ i )#define CLEAR( a , x ) memset ( a , x , sizeof a )map
p;struct node{ char s[1100];}e[5500*200];int cmp(node l1,node l2){ return strcmp(l1.s,l2.s)<0;}int main(){ std::ios::sync_with_stdio(false); char str[100]; int l=0; while(scanf("%s",str)!=EOF) { int len=strlen(str);// cout<<"2333 "<
<

转载于:https://www.cnblogs.com/blfshiye/p/5097019.html

你可能感兴趣的文章
OpenLayers 项目完整分析——(二)源代码总体结构分析
查看>>
python多线程和GIL全局解释器锁
查看>>
Mac OS10.9.2下的eclipse Pydev开发环境配置
查看>>
Bzoj3230: 相似子串
查看>>
有理想的程序员必须知道的15件事
查看>>
JVM学习笔记二_对象的创建、布局和定位
查看>>
python数据类型内置方法 字符串和列表
查看>>
mysql数据库还原出错ERROR:Unknown command ‘\\’解决手记
查看>>
python--sys模块
查看>>
论 <%@taglib prefix="s" uri="/struts-tags" %> 的重要性
查看>>
Linux 命令
查看>>
GBDT 总结文档
查看>>
ZJOI2006 物流运输
查看>>
easyui-menu 宽度自适应
查看>>
git 将本地项目关联到远程仓库
查看>>
网络开始---多线程---NSThread-02-线程状态(了解)(三)
查看>>
URL与资源
查看>>
反击爬虫,前端工程师的脑洞可以有多大?
查看>>
angularjs--ng-repeat
查看>>
从现在开始写博客啦!
查看>>