ok so use string. it will be almost a total rewrite, but it will certainly be smaller.
if you are going to do that consider making dictionary an unordered map (?) but I am really not sure what you are doing with the dictionary. It may need to be a vector of string.
The discussions you have on public fora are potentially valuable to others. Deleting the contents of the original post prevents others from benefiting from the discussion.
The original title of this post was "how can make this code shorter?"
And here is the code you posted in the OP.