Now I understand better what you mean, and in fact works perfectly as you say in this specific case and in all cases where you can use terminal characters to define the boundaries of a hotstring.
In fact, it is who writes the terminal character that orders at that time to AHK how to interpret its input.
But let's imagine the case of thousands of hotstring where we want to delegate to the program the use of the hotstring as long as possible: for us it would be impossible because of the huge number of possibilities.
This was the sense of the problem and that is why, to generalize it, I had proposed not to consider the terminal characters, whose use always requires an explicit choice of the writer.
The solution you have set up works perfectly with the use of terminal characters but requires attention and choice by the writer.
What can be done in the general case without terminal characters:
I try to write: 0123456789
I obtain 012len36789
but I desire 0len89
How can you give priority to the hotkey as long as possible that is applicable in the specific situation by pausing shorter hotstrings and applying them only in case the longest hotstring is no longer applicable?
For example if I try to write: 012345679
(the 8 is missing)
there would be no way to apply the hotstring "12345678", but only when it reaches "9", then hotstring "345" would be applied, and the end result would be 012len3679