Advertisement
mfgnik

Untitled

Jun 1st, 2020
750
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. int main() {
  4.   int last_now, now, amount = 0, amount_now = 0;
  5.   std::cin >> now;
  6.     if (now > 0) {
  7.     amount = amount_now = 1;
  8.   }
  9.   while (now != 0) {
  10.       last_now = now;
  11.       std::cin >> now;
  12.       if (now == last_now) {
  13.           amount_now += 1;
  14.           if (amount_now > amount) {
  15.               amount = amount_now;
  16.           }
  17.       } else {
  18.               amount_now = 1;
  19.       }
  20.      
  21.   }
  22.     std::cout << amount;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement