Control C501C P88087


Statement
 

pdf   zip

html

Your task is to write a program that reads a sequence of words and prints them in alphabetical order.

Input

The input starts with a natural number n and continues with the n words that your program must sort. All the words are formed exclusively by lowercase letters.

Output

The output is a line with the n words of the input in alphabetical order, separated by a comma.

Observation

You must use the algorithm insertion sort to solve this problem. Any other method will be qualified with a zero

Public test cases
  • Input

    3 helen george john
    

    Output

    george,helen,john
    
  • Input

    11
    a bird in the hand is
    worth two in the bush
    

    Output

    a,bird,bush,hand,in,in,is,the,the,two,worth
    
  • Input

    7 a az b b bz z za
    

    Output

    a,az,b,b,bz,z,za
    
  • Input

    0
    

    Output

    
            
                                
  • Input

    1 hello
    

    Output

    hello
    
  • Information
    Author
    Professorat de P1
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++
    User solutions
    C++ Java