DNA P67329


Statement
 

pdf   zip

html

Write a backtracking program that prints all the combinations of length n that can be made with the letters ‘A’, ‘C’, ‘G’, ‘T’ for a given n.

Input

The input consists of a natural number n > 0.

Output

Print all the combinations of n letters ‘A’, ‘C’, ‘G’, ‘T’ in lexicographical order.

Public test cases
  • Input

    2
    

    Output

    AA
    AC
    AG
    AT
    CA
    CC
    CG
    CT
    GA
    GC
    GG
    GT
    TA
    TC
    TG
    TT
    
  • Information
    Author
    Gabriel Valiente
    Language
    English
    Translator
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++
    User solutions
    C++ Python