Printing cool words P42568


Statement
 

pdf   zip

thehtml

In this problem, we say that a word is cool if it does not have two consecutive consonants. Write a program to print all the cool words with n lowercase letters, v of which are vowels, that can be made up from the x first letters of the alphabet.

For instance, these are some of the many cool words for n = 5, v = 3 and x = 5:

aabab ⁠ ⁠ababa ⁠ ⁠babaa ⁠ ⁠cecea ⁠ ⁠deeac

Input

Input consists of three natural numbers n > 0, 0 ≤ vn, and 2 ≤ x ≤ 26.

Output

Print, in alphabetic order, all the cool words with n lowercase letters, v of which are vowels, that can be made up from the x first lowercase letters. Assume that ‘y’ is a consonant.

Public test cases
  • Input

    3 2 3
    

    Output

    aab
    aac
    aba
    aca
    baa
    caa
    
  • Input

    2 1 5
    

    Output

    ab
    ac
    ad
    ba
    be
    ca
    ce
    da
    de
    eb
    ec
    ed
    
  • Input

    42 20 26
    

    Output

    
            
                                
  • Input

    31 15 2
    

    Output

    bababababababababababababababab
    
  • Input

    2 2 26
    

    Output

    aa
    ae
    ai
    ao
    au
    ea
    ee
    ei
    eo
    eu
    ia
    ie
    ii
    io
    iu
    oa
    oe
    oi
    oo
    ou
    ua
    ue
    ui
    uo
    uu
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Salvador Roura
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++
    User solutions
    C++