Description

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

HINT

#include<stdio.h>
#include<string.h>
char a[5000];
int t;
void zhuanhuan() //大小写转换
{
int i;
for(i=0;i<t;i++)
{
if(a[i]>='A'&&a[i]<='Z')
a[i]=a[i]+32;
}
}
int main()
{
char b[5000][200];
int i,j,m,n;
m=0;
int flag;
while(gets(a))//scanf("%s",a)!=EOF
{
j=0;
n=0;
t=strlen(a);
if(t==0)
continue;
zhuanhuan();
for(i=0;i<t;i++)
{
if((a[i]<='z'&& a[i]>='a'))
b[m][n++]=a[i];
else if(a[i]==' ')
{
b[m][n++]='\0';
m++;
n=0;
}
}
b[m++][n]='\0';
}
for(i=m-1;i>=0;i--)
{
for(j=0;j<i;j++)
{
if(strcmp(b[j],b[j+1])>0)
{
char w[30];
strcpy(w, b[j]);
strcpy(b[j],b[j+1]);
strcpy(b[j+1],w);
}
}
}
for(i=0;i<m;i++)
{
flag=1;
for(j=0;j<i;j++)
{
if((strcmp(b[i],b[j]))==0)
{
flag=0;
break;
} }
if(flag==1)
printf("%s\n",b[i]);
}
//for(i=0;i<m;i++)
// printf("%s\n",b[i]);
return 0;
}

Andy's First Dictionary的更多相关文章

  1. UVa 10815 Andy's First Dictionary

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

  2. UVa10815.Andy's First Dictionary

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

  3. Problem C: Andy's First Dictionary

    Problem C: Andy’s First DictionaryTime Limit: 1 Sec Memory Limit: 128 MBSubmit: 18 Solved: 5[Submit] ...

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

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

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

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

  6. 安迪的第一个字典(Andy's First Dictionary,UVa 10815)

    Description Andy, , has a dream - he wants to produce his very own dictionary. This is not an easy t ...

  7. STL语法——集合:set 安迪的第一个字典(Andy's First Dictionary,UVa 10815)

    Description Andy, , has a dream - he wants to produce his very own dictionary. This is not an easy t ...

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

  9. Winter-2-STL-E Andy's First Dictionary 解题报告及测试数据

    use stringstream Time Limit:3000MS     Memory Limit:0KB Description Andy, 8, has a dream - he wants ...

随机推荐

  1. 解决android开发webservice的发布与数据库连接的问题

    由于app后续开发的需要,移植了两次webservice和数据库,遇到了不少问题,也花费了很多时间,实践告诉我要学会寻找问题的根源,这样才能在开发中节省时间,尽快解决问题!好,废话不多说,转入正题…… ...

  2. aliyun 启用ECS iptables

    iptables -t nat -A POSTROUTING -s 0.0.0.0/24 -o eth0 -j MASQUERADEservice iptables saveecho 1 > / ...

  3. python字符串转义与正则表达式特殊字符转义

    最近在自学python,字符串和正则表达式的特殊字符转义有点混淆,做个笔记简单总结一下. 1.普通字符串转义 在字符串中使用特殊字符时,要用反斜杠(\)转义字符.例如:'Let\'s go!',这里对 ...

  4. 07.20 html5的适配flexible

    <script src="http://g.tbcdn.cn/mtb/lib-flexible/0.3.4/??flexible_css.js,flexible.js"> ...

  5. 关于Apacheserver的訪问控制

    Apache的訪问控制指对不论什么资源的不论什么方式的訪问控制. 一.基于主机或者IP地址的控制 这样的訪问控制基于訪问者的主机名或者IP地址,通过使用 Deny 和 Allow 指令.实现同意或者禁 ...

  6. 【Winform开发2048小游戏】

    先来看一下界面: 游戏帮助类 class GameCore { //游戏地图 private int[,] map = new int[4, 4]; //合并时用到的临时数组 private int[ ...

  7. vs2010调试快捷键

    VS2010单步调试  1.设置断点 F9设置或者取消断点,如果当前行未设置断点,则F9可以再当前行设置断点,如果已经设置,则为去除断点   2.单步调试 F10不进入函数单步,F11进入函数单步 , ...

  8. css Tab选项卡

    css tab 选项卡据说有2中实现方式 1. target css3 2. 描点 2的 核心原理是利用描点显示问题(描点父级 overflow). <style> body,div,ul ...

  9. 更改DataTable列名方法

    1.通过DataAdapter将查询的结果填充到DataSet的表(DataTable)中: 如:dataAdapter.Fill(dataSet),这时dataSet的表名默认为Table 如果使用 ...

  10. 如何使用JAVA语言抓取某个网页中的邮箱地址

    现实生活中咱们常常在浏览网页时看到自己需要的信息,但由于信息过于庞大而又不能逐个保存下来. 接下来,咱们就以获取邮箱地址为例,使用java语言抓取网页中的邮箱地址 实现思路如下: 1.使用Java.n ...