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