In this way, each subtree is generated only once.
we only need to consider two types of words: (i) the children of the rightmost leaf of S r , (ii) the adjacent right sibling of the any node in S r , as shown in Figure 2.