#include <iostream>
#include<regex>

int main() {
	std::regex r("\\{[^}]*\\}");
	std::string str("{1}, {2} and {3}");
	auto words_begin =
	        std::sregex_iterator(str.begin(), str.end(), r);
	auto words_end = std::sregex_iterator();
	for (std::sregex_iterator i = words_begin; i != words_end; ++i) {
		std::smatch m = *i;
		if (m.position() > 4) {
		  std::cout << m.str() << std::endl;
		}
	}
	return 0;
}