Advertisement
Saleh127

Untitled

May 1st, 2020
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int a[1000],b[1000];
  4. int main()
  5. {
  6. int t,c,i,j,d=0;
  7. scanf("%d",&t);
  8. for(i=1;i<=t;i++)
  9. {
  10. scanf("%d",&b[i]);
  11. if(a[b[i]]==0)
  12. d++;
  13. a[b[i]]=i;
  14. }
  15. cout<<d<<endl;
  16. for(j=1;j<=t;j++)
  17. {
  18. if(a[b[j]]==j) printf("%d ",b[j]);
  19. }
  20. return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement