Raslboyy

Untitled

Sep 29th, 2019
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     int A[10]{ 0 };
  8.     int n;
  9.     cin >> n;
  10.     for (int i = 0; i < n; i++) {
  11.         string str; cin >> str;
  12.         for (char ch : str)
  13.             A[ch - '0']++;
  14.     }
  15.        
  16.     int max = 0; int Mindex = 0;
  17.     for (int i = 0; i < 10; i++)
  18.         if (A[i] > max) {
  19.             max = A[i];
  20.             Mindex = i;
  21.         }
  22.    
  23.     for (int i = 0; i < 10; i++)
  24.         if (A[i] == max) cout << i << endl;
  25.    
  26.  
  27.        
  28.    
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment