Minimum Cost to Make All Characters Equal
Each boundary where neighbours differ must be crossed once, and the cheaper of its prefix or suffix flip pays for it.
Each boundary where neighbours differ must be crossed once, and the cheaper of its prefix or suffix flip pays for it.