因为这个我写了很久,结果发现不需要
string s;
cin >> s;
cout << "Output" << endl;
int list[(int)s.length()] = {};
int i = 0, size = 0;
//字符索引 整数个数
bool boo = 1;
string temp = "";
while (boo) {
if (s[i]==',') {
if (temp == "0") {
boo = 0;
continue;
}
list[size] = stoi(temp);
size++;
temp = "";
} else {
temp += s[i];
}
i++;
if (i >= (int)s.length()) {
if (temp == "0")
continue;
boo = 0;
list[size] = stoi(temp);
size++;
}
}