Advertisement
STANAANDREY

var4 2k16 22/2/2022

Feb 22nd, 2022
713
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     int k = 1, m = 1, n;
  7.     cin >> n;
  8.     while (n > 9) {
  9.         if (n % 10 == n / 10 % 10) {
  10.             k++;
  11.             if (k > m) {
  12.                 m = k;
  13.             } else {
  14.                 k = 1;
  15.             }
  16.         }
  17.         n /= 10;
  18.     }
  19.     cout << m << endl;
  20.     return 0;
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement