单词换行的输出的格式的问题,采用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问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!

相似问题

8
js算法 输入一篇英文文章,统计单词个数,并找出来重复的单词,并指明个数,并能替换想要替换的单词
15
C语言 为什么编译没问题运行时显示exe停止工作?
1
怎样用C语言编写这个程序?
1
给出一段没有标点的文章,找出第n个单词的长度c语言问题,代码哪里错了?困扰半天了求大佬解答
1
C语言。。。我真的不行了
2
mapreduce 实现单词的个数统计
1
c语言当中? : 三目运算符 中出现表达式必须是可修改的左值的问题
0
如何将字符串中所有单词摘出来到一个新的二维数组中
2
C语言数据文件处理技术问题,从3个单词文件中找出第1个在这3个文件中都出现的单词?
1
C语言萌新,对于编程思路不是很好,能否给点思路?问题在图片中!在线等 急?
2
html如何实现长英文单词换行,并且添加中划线换行符(连字符)?
0
使用C语言进行单词元音的判别的问题,具体的代码怎么实现的
1
C语言字符串数组问题:将文件中的多行文本存储到数组中
0
一个猜测单词的游戏的算法,利用C语言的方式是如何实现的呢
2
单词复数 萌新求助 用c语言解决
0
字母的排列构成的单词的算法的问题,是如何利用C语言的办法实现呢
0
根据模式的匹配去组合英文单词字母,运用C语言编程的技术的一个实现方式
4
输入一个英文句子,将单词的第一个字母改成大写字母,运用C语言怎么做
2
c语言 大量数据在写入文件时会崩溃 急求问题所在和解决办法
0
C语言的编程,输入一个英文句子,将每个单词的第一个字母改成大写字母