Untitled
raw download clone
CPP
views 13
,
size 641 b
#include <iostream>
#include <cstring>
using namespace std;

int main()
{
    char s[256];
    cin.getline(s,256);
    char n;
    int v[127] = {0},max=0;
    bool ok = 0;
    for(int i = 0 ; i < strlen(s) ; i++)
        if(s[i] >= '0' && s[i] <= '9' )
            v[s[i]]++, ok = 1;
      for(char i = '0' ; i <= '9' ; i++)
      {
          if(v[i] > 0)
             for(char c = '0' ; c <= '9' ; c++)
                 if(v[c] > max )
                 {
                     max = v[c];
                     n = c;
                 }
      }

    if(ok)
    cout<<n;
    else
    cout<<"NU";
    return 0;
}
close fullscreen
Login or Register to edit or fork this paste. It's free.