博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
HDU 1113 Word Amalgamation
阅读量:6452 次
发布时间:2019-06-23

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

Word Amalgamation
Time Limit:1000MS     Memory Limit:10000KB     64bit IO Format:%lld & %llu
 

Description

In millions of newspapers across the United States there is a word game called Jumble. The object of this game is to solve a riddle, but in order to find the letters that appear in the answer it is necessary to unscramble four words. Your task is to write a program that can unscramble words.

Input

The input contains four parts: 1) a dictionary, which consists of at least one and at most 100 words, one per line; 2) a line containing XXXXXX, which signals the end of the dictionary; 3) one or more scrambled 'words' that you must unscramble, each on a line by itself; and 4) another line containing XXXXXX, which signals the end of the file. All words, including both dictionary words and scrambled words, consist only of lowercase English letters and will be at least one and at most six characters long. (Note that the sentinel XXXXXX contains uppercase X's.) The dictionary is not necessarily in sorted order, but each word in the dictionary is unique.

Output

For each scrambled word in the input, output an alphabetical list of all dictionary words that can be formed by rearranging the letters in the scrambled word. Each word in this list must appear on a line by itself. If the list is empty (because no dictionary words can be formed), output the line "NOT A VALID WORD" instead. In either case, output a line containing six asterisks to signal the end of the list.

Sample Input

tarpgivenscorerefundonlytrapworkearncoursepepperpartXXXXXXresconfudreaptrsettoresucXXXXXX

Sample Output

score******refund******parttarptrap******NOT A VALID WORD******course****** 数据比较水 因为懒只做了前两个字母的排序 竟然过了...... strcmp大法好 另外一个点就是用sort对字符串进行排序
#include 
#include
#include
#include
using namespace std;struct node{ char c[10];}a[105],b[105],re[105];int cmp(node a,node b){ if(a.c[0]==b.c[0]) return a.c[1]

  

 

转载于:https://www.cnblogs.com/Hyouka/p/5705959.html

你可能感兴趣的文章
(转)CSS浮动(float,clear)通俗讲解
查看>>
os.walk函数
查看>>
[Unity3d]DrawCall优化手记
查看>>
细数.NET 中那些ORM框架 —— 谈谈这些天的收获之一
查看>>
关于Eclipse(MyEclipse)中一次性批量导入多个项目Project.
查看>>
关于修改Eclipse工作空间对应的文件夹名称之后的处理.
查看>>
JDK 5.0新特性
查看>>
树莓派 omv 安装 nextcloud
查看>>
Java基础 - 可变字符串 StringBuffer
查看>>
Windows下Oracle安装图解----oracle-win-64-11g 详细安装步骤
查看>>
[Programming Entity Framework] 第1章 ADO.NET实体框架介绍(二)
查看>>
<Jper和Iperf>的安装及使用
查看>>
SQL Serever学习7——数据表2
查看>>
洛谷——P2404 自然数的拆分问题
查看>>
(转)Mac 下设置android NDK的环境
查看>>
[struts]s:action 的使用方法
查看>>
dubbo问题总结
查看>>
20165320 第三周学习总结
查看>>
ucontext实现的用户级多线程框架3(实现echo服务器)
查看>>
Spring入门6事务管理2 基于Annotation方式的声明式事务管理机制
查看>>