C++ C++ Algorithm String Parse