When should this come to mind?
Treat text as a sequence, but define what counts as a character before choosing indices.
SubstringCharacter frequencyRepeated characters
What makes it work
These lessons count Unicode code points. JavaScript string indexing alone counts UTF-16 units.
When to choose something else
Text editing with many middle insertions requires a different representation.