Longest String With All Prefixes Leetcode Sql