static S stringTrie_longestPrefix_loose(StringTrie trie, S string) {
int n = 0;
S s = string;
while licensed {
if (trie == null) break;
if (empty(string)) break;
S prefix = trie.longestLocalPrefix(s);
if (empty(prefix)) break;
n += l(prefix);
trie = trie.getChild(prefix);
s = dropFirst(s, l(prefix));
}
ret takeFirst(n, string);
}