#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
int main() {
// Sample HTML elements
std::vector<std::string> htmlElements = {"<div>", "<p>", "<a>", "<span>", "<img>", "<h1>"};
// Condition for sorting (e.g., sorting by length of the HTML tags)
auto condition = [](const std::string& a, const std::string& b) {
return a.length() < b.length();
};
// Sorting HTML elements based on the condition
std::sort(htmlElements.begin(), htmlElements.end(), condition);
// Displaying the sorted HTML elements
std::cout << "Sorted HTML elements:\n";
std::copy(htmlElements.begin(), htmlElements.end(), std::ostream_iterator<std::string>(std::cout, "\n"));
return 0;
}