← All problemsSign in

One Change Subsequences

A string $t_1 t_2 \ldots t_m$ is called *good* if there is at most one position $1\le i < m$ such that $t_i \ne t_{i+1}$. For example `aaabb` and `zzz` are good strings; while `abc` and `ssdddssds` are not good. You are given a string $s$, consisting of lowercase English letters. Find the minimum $k$ such that you can split $s$ into $k$ *good* subsequences (a subsequence is not necessarily conti

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start