I’m wondering if it’s possible to solve the problem https://mirror.codeforces.com/problemset/problem/1383/A?locale=en with the additional constraint that, instead of being able to select subsets of the same letter, that you can only select substrings (letters that are all adjacent) all of the same letter. What time constraints could this be solved in?