编辑代码

#include <iostream>
#include <string>
#include <sstream>
#include <vector>
using namespace std;

int main() {
    string splitTarget = "hello######world###a#s#d";
    stringstream ss;
    ss << splitTarget;
    string temp;
    while (getline(ss, temp, '#')) {
        if (temp != "") { //分隔符连续时会得到空的字符串,需要过滤掉
            cout << temp << endl;
        }
    }
	return 0;
}