Add GetLongestPrefix method to Trie

Allows efficiently finding the best match for a given string slice.