Run of a word (source code)

= Run of a word

= Runs of a word
{synonym}

A run of a <word over an alphabet> is a maximal consecutive block of one repeated letter. For a nonempty word $w$ of length $N$, its number of runs is
$$
R(w)=1+\sum_{j=1}^{N-1}\mathbf1_{\{w_j\ne w_{j+1}\}}.
$$
Replacing a consecutive constant block changes this count only through its boundaries with the neighboring letters.