Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
There is always a consideration between using memory and speed. You should know that finding an index of a character in a string takes 0(n), compared to using a dictionary to store already computed values. Knowledge before commenting is crucial!
A perfect example of overthinking and making things complex for no reason.
There is several ways for this kind of work. But it depends on the language you are using. As an example, in c# there is a string function called Insert(). Using that function you can easilly do this task. There is some equivallent functions in most of the language. You should consult the respected documentation.