fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int arr[12] = { 1,3,5,0,7,2,0,4,4,0,8,8 };
  6. int count = 0;
  7. for (int i = 0; i<11; i++) {
  8. if (arr[i] = arr[i + 1])
  9. count++;
  10. else
  11. count--;
  12. }
  13. cout << count << endl;
  14. for (auto num : arr) {
  15. cout << num << ",";
  16. }
  17. cout << endl;
  18.  
  19. return 0;
  20. }
Success #stdin #stdout 0s 4304KB
stdin
Standard input is empty
stdout
5
3,5,0,7,2,0,4,4,0,8,8,8,