Problem 3441 · Hard

Minimum Cost Good Caption

Shift letters one alphabet step at a time until every run of equal letters is at least three long, using the fewest steps. Return the alphabetically first caption among the cheapest results, or an empty string if none is possible.

Open the interactive visualisation