Problem list
Log in
#r03115 · Online Judge > GoldOJ

O and X Combinations

Silver V 2.0 s 256 MB

Given $N$, print all $2^N$ strings of length $N$ made of O and X. Decide each position from the first to the last, always choosing O before X, so the output is in lexicographic order with O < X.

Input

One integer $N$ ($1 \le N \le 15$).

Output

Print all $2^N$ combinations, one per line.

Example 1

Input
3
Output
OOO
OOX
OXO
OXX
XOO
XOX
XXO
XXX
Source
Online Judge > GoldOJ
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code