Advertisement
Tudor_Chender

Varianta 59 2009

Nov 18th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. #include <climits>
  4. using namespace std;
  5. char x[55];
  6. int ap[10];
  7. int main()
  8. {
  9.     int maxim=INT_MIN, i, mxm, ok=0;
  10.     cin.getline(x,55);
  11.     for(i=0;i<strlen(x);i++)
  12.     {
  13.         if(x[i]>='0' && x[i]<='9')
  14.         {
  15.             x[i]=x[i]-48;
  16.             ap[x[i]]++;
  17.             ok++;
  18.         }
  19.     }
  20.     for(i=0;i<=9;i++)
  21.     {
  22.         if(ap[i]>maxim)
  23.         {
  24.             maxim=ap[i];
  25.             mxm=i;
  26.         }
  27.     }
  28.     if(ok==0)
  29.     {
  30.         cout<<"NU";
  31.     }
  32.     else
  33.     {
  34.         cout<<mxm;
  35.     }
  36.     return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement