#include <iostream>
#include <sstream>
using namespace std;
int main() {
stringstream is("{ beforechars [{Object1},{Object2},{Object3}] afterchars }");
string content;
std::getline(is, content, '[');
auto pos = is.tellg();
while (std::getline(is,content,'{') && !is.eof()) {
std::getline(is,content,'}');
pos = is.tellg();
std::cout << content << std::endl;
}
is.seekg(pos);
std::getline(is,content);
std::cout<<"FINAL:"<<content<<std::endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3N0cmVhbT4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCkgewoJc3RyaW5nc3RyZWFtIGlzKCJ7IGJlZm9yZWNoYXJzIFt7T2JqZWN0MX0se09iamVjdDJ9LHtPYmplY3QzfV0gYWZ0ZXJjaGFycyB9Iik7CglzdHJpbmcgY29udGVudDsgCgkKCXN0ZDo6Z2V0bGluZShpcywgY29udGVudCwgJ1snKTsKCWF1dG8gcG9zID0gaXMudGVsbGcoKTsgCgl3aGlsZSAoc3RkOjpnZXRsaW5lKGlzLGNvbnRlbnQsJ3snKSAmJiAhaXMuZW9mKCkpIHsKICAgIAlzdGQ6OmdldGxpbmUoaXMsY29udGVudCwnfScpOwogICAgCXBvcyA9IGlzLnRlbGxnKCk7IAogICAgCXN0ZDo6Y291dCA8PCBjb250ZW50IDw8IHN0ZDo6ZW5kbDsKCX0KCWlzLnNlZWtnKHBvcyk7IAoJc3RkOjpnZXRsaW5lKGlzLGNvbnRlbnQpOwoJc3RkOjpjb3V0PDwiRklOQUw6Ijw8Y29udGVudDw8c3RkOjplbmRsOyAKCQoJcmV0dXJuIDA7Cn0=