英语题翻译24

Word Amalgamation | JXNUOJ

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.

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.

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.

翻译:

在美国数以百万计的报纸中,有一个文字游戏叫做Jumble。这个游戏的目的是解决一个谜题,但为了找到答案中出现的字母,有必要解读四个单词。你的任务是写一个可以解读四个字的程序。

输入包含四个部分:1、一本由至少1个,至多100个单词组成的字典,一个单词一行;2、一行包含XXXXXX,表示字典的结束;3、一个或多个未解读的单词你需要解读,一行一个;4、另起一行包含XXXXXX,表示文件的结束。所有单词,包括字典单词和未解读单词,仅由小写英文字母组成,长度至少为 1 且最多为 6 个字符。(注意:标记 XXXXXX 包含大写的 X)。字典不一定按排序顺序排列,但字典中的每个单词都是唯一的。

对输入中每个未解读的单词,输出所有字典单词的字母列表,这些单词可以通过重新排列打乱单词中的字母来形成,列表中的每个单词必须单独成行。如果列表是空的(因为无法形成字典单词),输出一行``NOT A VALID WORD" 。在任何一种情况下,输出一行包含六个星号来表示列表的结束。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值