Hello,
It seems that your program can be implemented by preparing an index on the first two fields, i.e. the matching fields, and then scanning the index for the input string to obtain the corresponding shift fields. It also seems that we may have to use regular expressions for matching purposes.
Being worked on some similar projects in C (where we needed to parse an input matrix file, stored in different forms, and to process and transpose them as fast as possible - one of the projects is listed in my portfolio) and as I usually work in C# using Visual Studio 2012 and 2017 to develop desktop applications, I think it will not be very difficult for me to help you in developing the required program in C++.
So please let me know if you find this proposal useful so that I can help you with the given project.
Regards.