Problem 2670 · Easy
Compute the distinct counts of every prefix and suffix, then subtract them at each index.
Open the interactive visualisation