Mathematical and Physical Journal
for High Schools
Issued by the MATFUND Foundation
Already signed up?
New to KöMaL?
I want the old design back!!! :-)

Problem S. 17. (April 2006)

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.

(10 pont)

Deadline expired on May 15, 2006.


Statistics:

6 students sent a solution.
10 points:Gilián Zoltán.
9 points:Engedy Balázs.
8 points:1 student.
7 points:1 student.
6 points:1 student.
4 points:1 student.

Problems in Information Technology of KöMaL, April 2006