Advertisement
TimxAG

Untitled

Jul 1st, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int n; cin >> n;int a[n],b[n],i,count=0;
  6. for (i=0;i<n;i++)
  7. cin >> a[i];b[0]=a[0];
  8. for (i=1;i<n;i++)
  9. {
  10. if (a[i]==a[i-1]) { count ++ ;b[i]=INT_MIN; } else b[i]=a[i];
  11. }
  12. cout << count << endl;
  13. for(i=0;i<n;i++)
  14. if (b[i]!=INT_MIN) cout << b[i] << " ";
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement