#include <iostream>
#include <cstring>
#include <vector>
int main()
{
char largechars[] = "def1:def2:def3#abc1:abc2:abc3#ghi1:ghi2:ghi3";
std::vector<char*> v;
char* chars_array = strtok(largechars, "#");
while(chars_array)
{
v.push_back(chars_array);
chars_array = strtok(NULL, "#");
}
for(size_t n = 0; n < v.size(); ++n)
{
char* subchar_array = strtok(v[n], ":");
while (subchar_array) {
// MessageBox(NULL, subchar_array, NULL, NULL);
std::cout << subchar_array << '\n';
subchar_array = strtok(NULL, ":");
}
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0cmluZz4KI2luY2x1ZGUgPHZlY3Rvcj4KaW50IG1haW4oKQp7CiAgICBjaGFyIGxhcmdlY2hhcnNbXSA9ICJkZWYxOmRlZjI6ZGVmMyNhYmMxOmFiYzI6YWJjMyNnaGkxOmdoaTI6Z2hpMyI7CiAgICBzdGQ6OnZlY3RvcjxjaGFyKj4gdjsKICAgIGNoYXIqIGNoYXJzX2FycmF5ID0gc3RydG9rKGxhcmdlY2hhcnMsICIjIik7CiAgICB3aGlsZShjaGFyc19hcnJheSkKICAgIHsKICAgICAgICB2LnB1c2hfYmFjayhjaGFyc19hcnJheSk7CiAgICAgICAgY2hhcnNfYXJyYXkgPSBzdHJ0b2soTlVMTCwgIiMiKTsKICAgIH0KCiAgICBmb3Ioc2l6ZV90IG4gPSAwOyBuIDwgdi5zaXplKCk7ICsrbikKICAgIHsKICAgICAgICBjaGFyKiBzdWJjaGFyX2FycmF5ID0gc3RydG9rKHZbbl0sICI6Iik7CiAgICAgICAgd2hpbGUgKHN1YmNoYXJfYXJyYXkpIHsKLy8gICAgICAgICAgICBNZXNzYWdlQm94KE5VTEwsIHN1YmNoYXJfYXJyYXksIE5VTEwsIE5VTEwpOwogICAgICAgICAgICBzdGQ6OmNvdXQgPDwgc3ViY2hhcl9hcnJheSA8PCAnXG4nOwogICAgICAgICAgICBzdWJjaGFyX2FycmF5ID0gc3RydG9rKE5VTEwsICI6Iik7CiAgICAgICAgfQogICAgfQp9Cg==