Problem 3084 · Medium
If c occurs cnt times, the substrings starting and ending with c number cnt * (cnt + 1) / 2.
Open the interactive visualisation