#include <iostream>
#include <set>
#include <string>
int main() {
std::set<int> numbers = {5, 2, 8, 1, 9, 3, 7};
// Inserting elements
numbers.insert(4);
numbers.insert(6);
numbers.insert(2); // Duplicate, won't be inserted
// Printing the set
std::cout << "Numbers in the set:" << std::endl;
for (const auto& num : numbers) {
std::cout << num << " ";
}
std::cout << std::endl;
// Checking if an element exists
if (numbers.find(5) != numbers.end()) {
std::cout << "5 is in the set" << std::endl;
}
// Removing an element
numbers.erase(3);
// Size of the set
std::cout << "Number of elements: " << numbers.size() << std::endl;
return 0;
}