On 11/3/21 11:41 AM, Stanislav Blinov wrote: > And Ali... associative arrays? For this? What are you trying to teach > the good beginner here? :D
Obviously, we're all enjoying this thread but once the OP made it clear that they wanted a C-like solution, I took some liberty with alternative solutions. :)
I think even in production code I would implement something similar at least to keep selection characters like 'n' together with their long forms like "negative".
I might use linear searching instead of an assoiative array (or store the assoiative arrays for later use, which I did think about before posting it). But, considering they are generated when interacting with stdin, likely fed by a human, the time loss there is zero. :)
Ali