S. 17. Write a program that plays the following word game. A list of words (at most 20) is read from the standard input, one word per line and ending in an empty line. Your program should display two sentences in two lines on the standard output, consisting of the given words in such an order that concatenation of words of the two sentences should yield the same string, with the very first letter being the only possible exception. The number of occurrences of a given word in the output should be equal to that of in the input list. It is of course ignored whether the solution conveys a meaning or not. If there is no solution, print ``No solution''.
See the examples (that even make sense in Hungarian).
The source code (s17.pas, s17.cpp, ...) and the documentation of your program should be submitted.
Deadline expired on 15 May 2006.