问题 23891 --CCC 1997 01 Sentences

23891: CCC 1997 01 Sentences

时间限制: 1 Sec  内存限制: 128 MB
提交: 1  解决: 0
[提交][状态][讨论版][命题人:]

题目描述

写一个程序,输入一个有主语,动词,宾语的列表,并产生所有可能的句子(由一个主语,一个动词,和一个宾语组成)。

输入

输入文件的第一行包含一个正整数n(总组数)。
以下每一组的1-3 行,有一个小于等于20的数,表示主语,动词,和宾语的总数。每一组余下的若干行为主语,动词,和宾语(按字母排列顺序输入,每行一个,主语,动词和宾语长度都不超过25位)。

输出

按字母顺序输出所有可能的句子(由一个主体,一个动词,和一个宾语组成),一句一行。

样例输入

1
3
3
2
He
The cat
The dog
bit
kicked
saw
him
the mouse

样例输出

He bit him.
He bit the mouse.
He kicked him.
He kicked the mouse.
He saw him.
He saw the mouse.
The cat bit him.
The cat bit the mouse.
The cat kicked him.
The cat kicked the mouse.
The cat saw him.
The cat saw the mouse.
The dog bit him.
The dog bit the mouse.
The dog kicked him.
The dog kicked the mouse.
The dog saw him.
The dog saw the mouse.

提示


来源

[提交][状态]