#include <unordered_map>
#include <iostream>
#include <vector>
int findElementThatAppearsOnceInArray(std::vector<int>& vec) {
std::unordered_map<int, int> map;
for (auto x: vec) {
map[x]++;
}
for (auto x: map) {
if (x.second == 1) {
return x.first;
}
}
return -1;
}
int main() {
std::vector<int> vec {3, 5, 5, 2, 7, 3, 2, 8, 8, 3, 2, 5, 8};
std::cout << findElementThatAppearsOnceInArray((vec));
}
/*
run:
7
*/