///Salut, aceasta este rezolvarea:
#include<iostream>
using namespace std;
int main(){int v[20],i,n,h,p,g;
cout << "Cate numere utilizati:";cin>>n;
for (i = 0 ; i < n ; i++){ cout << "Introduceti o valoare:";cin >> v[i];}
for (i = 0 ; i < n ; i++){ for(p=i+1;p<n;p++){ if(v[i]==v[p]){
if(v[i]==v[i+1]) g=1; else g=0;
for(h=i;h<n;h++) v[h]=v[h+1]; n--;
if(g==1) for(h=i;h<n;h++) v[h]=v[h+1];
else for(h=p;h<n;h++) v[h]=v[h+1]; n--;
} }
}for (i = 0 ; i < n ; i++){ cout << v[i]<< ' ';}
return 0;}