SLEXSORT - Lexicographic sort
Given alphabet A and a list of words, sort the list according to the lexicographic order induced by A.
The first line of input contains t, the number of tests.
Each test begins with a line with alphabet A, which consists of lowercase letters arbitrary chosen from the Latin alphabet. The next line contains an integer n<100 000 - the number of words. The subsequent n contain one word each, which is not longer than 1 000 letters. Additionally, you can assume that the total number of letters in all words of each test does not exceed 4*106.
There is an empty line after each test.
For each test output the sorted list of words in successive lines.
The score is equal to the length of the source code of your program.
Input: 2 re 3 ere rer re balujemy 5 bel luba lej bal leje Output: re rer ere bal bel luba lej lejeWarning: large Input/Output data, be careful with certain languages
Will there be a new line character after every test case, even after the last test case? If I get a runtime error in Python3 where can we find out which line is causing it? I used ideone but my code is doing good there but giving runtime error while my code is run by judge.
how do i make space for 100000 words in memory??
got AC in C++ in 1.2 seconds
68 for Perl now too :-)