Longest String With All Prefixes Leetcode