Można tak:
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <vector>
const char* ws(const char *s)
{
while(*s && std::isspace(*s)) ++s;
return s;
}
bool expect(const char* &s, char c)
{
const char* s2 = ws(s);
if(*s2 == c) { s = s2 + 1; return true; }
return false;
}
std::vector<int> parseLine(const char* s)
{
std::vector<int> v;
if(expect(s, '{')) {
while(*s && !expect(s, '}')) {
char* s2;
v.push_back(std::strtol(s, &s2, 10));
s = s2;
}
}
return v;
}
int main()
{
std::string line;
while (std::getline(std::cin, line)) {
auto v = parseLine(line.c_str());
for(auto i : v) std::cout << i << ' ';
if(v.empty()) std::cout << "------------\n";
else std::cout << '\n';
}
}