Solve ShortestUniquePrefix.