Thank you. It seems can be solved by using C++ vector string and multimap but not sure how efficient they are. The total string number is not known. I do not like to do memory allocation but if using those library , I wonder if they will make execution slower than pure C.