Problem 2262 · Hard

Total Appeal of A String

Add up the distinct-letter count of every substring by tracking how far back each letter last appeared.

Open the interactive visualisation