I, on the other hand, don't think that tries are the best data structure for this problem. Any data structure used for this problem has a construction penalty, especially once you break the 1 s barrier. I think an exhaustive search with good short circuiting heuristics goes best here combined with cheap to construct data structures.
What kept me inspired was the fact that the former first place implementation was written in PASCAL. Surely, I could not let this stand, to the embarassment of C++ programmers, everywhere

.
Michael Goldshteyn
( 10745 - 0.129 s )
P.S. for those that still do not understand the problem statement, here is a simplified version:
Given strings A and B. B dominates A if BOTH conditions below are satisfied:
- Every distinct character in A also appears in B
- Any character that appears multiple times in A must appear at least that many times in B
So, a simple way of saying this is that a string B dominates a string A if A can be constructed using some or all of the characters from B.
Here are examples where the first string is dominated by the second:
abc bac (in fact, each dominates the other, so neither is a dominant string)
abc dcba
aabcc aaabccd
abccc aaabccddcc
Examples where the first string is NOT dominated by the second:
abc abdefg
abbc abcadef
aabbbcccc abbabcddcbce