反弹的单词的字符串,怎么使用 C 语言的程序代码编写的方式的技术思想来实现的呢?

Problem Description
Lingo is a once popular game show where the contestants have to guess words. In the original version the contestants would have to guess a five-letter word each round.
In between the rounds of regular word guessing, the contestants can win a bonus prize if they can guess a ten-letter word. The ten-letter word is displayed with the letters permuted. Some letters are colored indicating that they are displayed in the right position. Since there are not that many ten-letter words, it happens frequently that the word is actually a compound: a word constructed by concatenating two shorter words. In this problem we
assume that the ten-letter word is always of this form.
Given a dictionary and a sequence of ten letters, you must calculate the possible solutions to the ten-letter word game. Two solutions are considered different if they are constructed from different parts, even if their concatenation is the same. This is illustrated by the the second sample case.

Input
On the first line an integer t (1 <= t <= 100): the number of test cases. Then for each test case:

One line with an integer n (1 <= n <= 200): the number of words in the dictionary.

n lines with a single word in the dictionary. Each word is between 1 and 9 (inclusive) characters long and consists of only lowercase letters.

One line with an integer q (1 <= q <= 100): the number of queries.

q lines with a single query string. Each query is exactly 10 characters long and will consist of uppercase and lowercase letters. Lowercase letters are in the right position and uppercase letters may be in the wrong position.
All words in the dictionary for a single test case are distinct.

Output
For each test case, output for each query:

One line with an integer s: the number of solutions.

min(1000, s) lines, each a solution formatted as two dictionary words separated by a hyphen (-).

The solutions to a single query must be ordered lexicographically. If the number of solutions exceeds 1000, then only output the first 1000 solutions.

Notes
If s and t are strings of equal length and si denotes the ith character of s, then s precedes t lexicographically if for some i: si < ti and sj = tj for all j < i. In this problem statement, the hyphen precedes all letters lexicographically.

Sample Input
2
5
gunner
integral
relating
tail
un
4
TAILGUNNER
unINTEGRAL
UNrelating
IMPOSSIBLE
3
aaaa
aaaaa
aaaaaa
1
AAAAAAAAAA

Sample Output
6
gunner-tail
integral-un
relating-un
tail-gunner
un-integral
un-relating
2
un-integral
un-relating
1
un-relating
0
3
aaaa-aaaaaa
aaaaa-aaaaa
aaaaaa-aaaa

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!

相似问题

2
如何用C语言字符串相关知识编写这个程序
1
查找其中的最大字母,在该字母后面插入字符串“(max)”,C语言编写代码的做法
0
用字符串实现单词置换字母的程序的算法,采用C语言的编写代码的技术的实现怎么做
0
字符串在序列中的排列组合的一个算法难题,怎么使用C程序的语言的代码编写的过程的做法?
0
求给定的字符串的一个子字符串的问题,运用C程序的语言的编写代码的实现的方式怎么做?
0
排序后计算rank的字符串的处理的问题,怎么利用C程序的代码语言的编写程序的过程去实现呢?
0
用字符串来表示的等式的问题的算法,采用C语言程序设计语言编写程序代码的思路做法
0
字符串分离的代码问题,怎么采用C语言程序设计的方式实现代码编写的过程?
0
通过程序判断s2 是s1的亲和串,具体使用C语言这个程序设计语言的代码的编写的技术如何实现的?
0
输出字符串人名是否是唯一的,怎么利用C语言的程序的代码的编写的思路实现的?
0
DNA序列字符串的一个处理修改的问题,怎么使用C程序语言代码编写的过程来编程解决的?
0
字符串运用的查找最大元素,怎么采用C语言的程序代码编写的过程的方式去实现
1
计算字符串第R位,含有的B的个数是多少,运用C语言的代码编写程序的思想来实现?
0
字符串的排序输出编号的问题,怎么采用C语言程序的代码编写过程的思想方法?
0
文本字符串的生成算法问题,怎么采用C语言的程序的代码编写的思想有效实现的
0
用下划线链接的字符串的输出问题,怎么使用C语言的代码的编写程序的思想实现呢?
0
输出回声字符串的问题,字符串的重复,怎么利用C语言的程序的编写的方式来实现的代码
0
字符串上二进制位的计算提取,怎么用C语言的程序的代码的编写的过程实现的
2
文件中字符串的匹配判断输出的问题,怎么正确地运用 C语言的程序设计语言的编写代码的方式解决思想
0
根据字符串求最大回文字符串,怎么用C语言的程序的编写的代码的过程去实现字符串的构造