We’re preparing your current view and syncing the latest data.
Given a string s, for each prefix of s, define its score as the length of the longest substring starting at the beginning of s that matches a prefix of the current prefix. Return the sum of these scores for all prefixes of s.
A single string s consisting of lowercase English letters.
An integer representing the sum of the scores of all prefixes of s.
1 <= s.length <= 10^5