Word inversion number
= Word inversion number
{title2=$\operatorname{inv}(w)$}
The number of <inversions of a word>: pairs of positions $i<j$ with $w_i>w_j$. Unlike an <inversion of a permutation>, this definition permits repeated letters in the word.