#include <iostream>
#include <string.h>
using namespace std;
int main(int argc, char* argv[])
{
int count[10] = {0};
int max_i = 0;
char str[513] = {'\0'};
cout << "Vvedite stroku: ";
cin.getline(str, 512);
cin.sync();
for (unsigned int i = 0; i < strlen(str); i++)
if (str[i] >= '0' && str[i] <= '9')
count[str[i]-'0']++;
for (int i = 0; i < 10; i++)
if (count[max_i]<count[i])
max_i = i;
cout << "Samaya chastaya tsifra = " << max_i << endl;
system("pause");
return 0;
}
Результат работы программы
