changing trie so characters from the reader must match a predicate to be counted, also adding some more test for edge cases