#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
template <typename T>
void unique_elements(std::vector<T>& vec)
{
std::map<T, int> m;
for(auto p=vec.begin(); p!=vec.end(); ++p)
m[*p]++;
vec.clear();
for(auto p=m.begin(); p!=m.end(); ++p)
if (p->second == 1) vec.push_back(p->first);
}
int main()
{
using std::vector;
using std::string;
vector<string> v{"b","a","x","y","z","a","a","z"};
unique_elements(v);
for(auto p=v.begin(); p!=v.end(); ++p)
{
std::cout << *p << std::endl;
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8bWFwPgojaW5jbHVkZSA8YWxnb3JpdGhtPgogCgogCnRlbXBsYXRlIDx0eXBlbmFtZSBUPgp2b2lkIHVuaXF1ZV9lbGVtZW50cyhzdGQ6OnZlY3RvcjxUPiYgdmVjKQp7CiAgCiAKICBzdGQ6Om1hcDxULCBpbnQ+IG07CiAKICBmb3IoYXV0byBwPXZlYy5iZWdpbigpOyBwIT12ZWMuZW5kKCk7ICsrcCkgCiAgICBtWypwXSsrOwogCiAgdmVjLmNsZWFyKCk7CiAKICBmb3IoYXV0byBwPW0uYmVnaW4oKTsgcCE9bS5lbmQoKTsgKytwKSAKICAgIGlmIChwLT5zZWNvbmQgPT0gMSkgdmVjLnB1c2hfYmFjayhwLT5maXJzdCk7Cn0KIAppbnQgbWFpbigpCnsKICB1c2luZyBzdGQ6OnZlY3RvcjsKICB1c2luZyBzdGQ6OnN0cmluZzsKIAogIHZlY3RvcjxzdHJpbmc+IHZ7ImIiLCJhIiwieCIsInkiLCJ6IiwiYSIsImEiLCJ6In07CiAKICB1bmlxdWVfZWxlbWVudHModik7CiAKICBmb3IoYXV0byBwPXYuYmVnaW4oKTsgcCE9di5lbmQoKTsgKytwKQogIHsKICAgIHN0ZDo6Y291dCA8PCAqcCA8PCBzdGQ6OmVuZGw7CiAgfQogIAp9