LearnPy Hub
← Recursion & Lambda problems
Hard

Binary Strings Without 11

Read n (1–12). Recursively build all binary strings of length n that never have two 1s next to each other. Print how many there are, then the strings in increasing order on one line.

Input

One integer.

Output

Two lines.

Sample 1

Input
3
Output
5
000 001 010 100 101

Sample 2

Input
1
Output
2
0 1
solution.py
Output appears here
Binary Strings Without 11 · Python practice problem · LearnPy Hub