Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- int main()
- {
- int n, a;
- vector <int> list;
- vector <int> shortList;
- cin >> n;
- for(int i = 0; i < n; i++)
- {
- cin >> a;
- list.push_back(a);
- }
- bool copy = false;
- for (auto it1 = list.begin(); it1 != list.end(); it1++)
- {
- copy = false;
- for (auto it2 = it1 + 1; it2 != list.end(); it2++)
- {
- if(*it1 != *it2)
- {
- copy = true;
- }
- }
- if(copy)
- {
- shortList.push_back(*it1);
- }
- }
- for(int i = 0; i < shortList.size(); i++)
- {
- cout << shortList[i] << " ";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement