You are given a bit string with n characters. In each step, you may erase two adjacent bits that are different. How many ways there are to erase all bits?
For example, when the bit string is 101100, there are 5 possible ways:
101100→1100→10→ (empty)
101100→1100→10→ (empty)
101100→1010→10→ (empty)
101100→1010→10→ (empty)
101100→1010→10→ (empty)
You may assume that 1≤n≤30. The algorithm should be efficient in all these cases.
In a file biterase.py, implement a function count that returns the number of ways to erase all bits.