#include <iostream>
#include <algorithm> //常用库函数一般在algorithm里
#include <vector>
using namespace std;
int main(){
// vector<int> a({1, 2, 3, 4, 5});
// int a[] = {1, 2, 3, 4, 5};
// reverse(a, a + 5);//第一个参数是第一个位置 第二个参数是最后一个位置的下一个位置
// // reverse(a.begin(), a.end());
// for(int x : a) cout << x << ' ';
// cout << endl;
// int a[] = {1, 2, 3, 4, 5};
// reverse(a, )
// unique去重
// unique可以帮忙把数组里面的重复元素删掉
// 112334变成1234 unique函数还有返回值 返回值是不同元素的下一个位置
//相当于返回新数组的end
// int a[] = {1, 1, 2, 2, 3, 3, 4};
vector<int> a({1, 1, 2, 2, 3, 3, 4});
// int m = unique(a, a + 7) - a;
// int m = unique(a.begin(), a.end()) - a.begin();
a.erase(unique(a.begin(), a.end(), a.end()));//这个可以直接去重然后放到数组最开头位置 然后把后面多余部分删掉
//然后a这个vector就会变成1234
for(auto x : a) cout << x << ' ';
cout << endl;
// cout << m << endl;
for(int i = 0; i < m; i++) cout << a[i] << ' ';
cout << endl;
return 0;
}