KöMaL - Középiskolai Matematikai és Fizikai Lapok
Sign In
Sign Up


Problem S. 7. (March 2005)

S. 7. Given a set of words, each of length between 5 and 30 letters. Write a program to sort them such that the last 5 letters of each word matches the first 5 letters of the next one. The number of words is at most 10,000 and only the 26 lower case letters of the English alphabet are used.

The first line of the input contains the number of words; then each subsequent line contains one word. If there exists a proper sorting, write one to the output such that each line contains one word. If there is no solution, just display NO SOLUTION.

(10 pont)

Deadline expired on 15 April 2005.


4 students sent a solution.
10 points:Nikházy László , Stippinger Marcell.
5 points:1 student.
0 point:1 student.

Our web pages are supported by:   Ericsson   Cognex   Emberi Erőforrás Támogatáskezelő   Emberi Erőforrások Minisztériuma   Nemzeti Tehetség Program    
MTA Energiatudományi Kutatóközpont   MTA Wigner Fizikai Kutatóközpont     Nemzeti
Kulturális Alap   ELTE   Morgan Stanley