Store ending length in trie as well as features mask