vlatkovski

Rodenden

Jun 2nd, 2017
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int n; cin >> n;
  6.     map<int, int> counts;
  7.     while (n != 0) {
  8.         int c = n % 10;
  9.         if (c == 9) {
  10.             c = 6;
  11.         }
  12.         counts[c]++;
  13.         n /= 10;
  14.     }
  15.     if (counts[6] % 2 == 1) {
  16.         counts[6] = counts[6]/2 + 1;
  17.     }
  18.     else {
  19.         counts[6] /= 2;
  20.     }
  21.     int cm = -1;
  22.     for (int i = 0; i < 10; ++i) {
  23.         if (counts[i] > cm) {
  24.             cm = counts[i];
  25.         }
  26.     }
  27.     cout << cm << endl;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment