fork(1) download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4. int main(){
  5. int a, b = 0, c = 0, d = 1, e = 0, f;
  6. cin >> a;
  7. do{
  8. if(a != 0 && b == 0){
  9. if(c == a){
  10. d++;
  11. }
  12. c = a;
  13. }
  14. else{
  15. b++;
  16. }
  17. }while(cin >> a);
  18. cout << d;
  19. return 0;
  20. }
Success #stdin #stdout 0s 5324KB
stdin
1 2 3 3 3 3 4 5 3 4 0 5


stdout
4