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