S -> a A c | a B d.
A -> z.
B -> z.
The test string can be azc.
S -> a A c | a B d.
A -> z.
B -> z.
The test string can be azc.
| import bisect | |
| import itertools | |
| import operator | |
| class _BNode(object): | |
| __slots__ = ["tree", "contents", "children"] | |
| def __init__(self, tree, contents=None, children=None): | |
| self.tree = tree | |
| self.contents = contents or [] |
| import bisect | |
| import itertools | |
| import operator | |
| class _BNode(object): | |
| __slots__ = ["tree", "contents", "children"] | |
| def __init__(self, tree, contents=None, children=None): | |
| self.tree = tree |