#include <stdio.h>
#define IOVEC(s) s, (sizeof(s) - 1)
char mostFrequentCharacter(const char* str, int size)
{
unsigned int count[128] = { 0 };
char ret = 0;
for (; size--; str++) {
if (++count[*str] > count[ret]) {
ret = *str;
}
}
return ret;
}
int main(void) {
printf("%c\n", mostFrequentCharacter
(IOVEC
("mamku tvoyu ebal"))); return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNkZWZpbmUgSU9WRUMocykgcywgKHNpemVvZihzKSAtIDEpCgpjaGFyIG1vc3RGcmVxdWVudENoYXJhY3Rlcihjb25zdCBjaGFyKiBzdHIsIGludCBzaXplKQp7Cgl1bnNpZ25lZCBpbnQgY291bnRbMTI4XSA9IHsgMCB9OwoJY2hhciByZXQgPSAwOwoKCWZvciAoOyBzaXplLS07IHN0cisrKSB7CgkJaWYgKCsrY291bnRbKnN0cl0gPiBjb3VudFtyZXRdKSB7CgkJCXJldCA9ICpzdHI7CgkJfQoJfQoKCXJldHVybiByZXQ7Cn0KCmludCBtYWluKHZvaWQpIHsKCXByaW50ZigiJWNcbiIsIG1vc3RGcmVxdWVudENoYXJhY3RlcihJT1ZFQygibWFta3UgdHZveXUgZWJhbCIpKSk7CglyZXR1cm4gMDsKfQo=