//уже функция которая есть void validate_tag(const text_buffer & text) { bool comment = false; std::stack tags; text_buffer::const_iterator cur = text.begin(), end = text.end(); for (;cur != end;++cur) { if (*cur == '!') comment=!comment; if (!comment) { if( tgOpen.find(*cur) != std::string::npos) { std::cout << *cur << std::endl; tags.push(*cur); continue; } int n; if( (n = tgClose.find(*cur)) != std::string::npos) { std::cout << *cur << std::endl; if (!tags.empty()) { if (tgOpen[n] != tags.top()) std::cout<<"tags error: no open tag!"<