#include <stdio.h>
#include <string.h>
int main() {
fgets (frase
, 256, stdin
);
// Verificando se o último caracter é uma quebra de linha e substituindo
if (frase
[strlen(frase
)-1] == '\n') { frase
[strlen(frase
)-1] = '\0'; }
// Ordenando a frase
for (int i
= 0; i
< strlen(frase
); i
++) { for (int o
= 0; o
< strlen(frase
); o
++) { if (frase[i] < frase[o]) {
char temp = frase[i];
frase[i] = frase[o];
frase[o] = temp;
}
}
}
// Imprimindo na tela
char caracterAtual = frase[1];
int contador = 0;
for (int i
= 1; i
<= strlen(frase
); i
++) { if (frase[i] != ' ') {
if (frase[i] == caracterAtual) {
contador++;
} else {
if (caracterAtual != ' ') {
printf("%c = %d\n", caracterAtual
, contador
); }
contador = 1;
caracterAtual = frase[i];
}
}
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdHJpbmcuaD4KCmludCBtYWluKCkgewogICAgY2hhciogZnJhc2UgPSBtYWxsb2MoMjU2KTsKICAgIGZnZXRzIChmcmFzZSwgMjU2LCBzdGRpbik7CgogICAgLy8gVmVyaWZpY2FuZG8gc2UgbyDDumx0aW1vIGNhcmFjdGVyIMOpIHVtYSBxdWVicmEgZGUgbGluaGEgZSBzdWJzdGl0dWluZG8KICAgIGlmIChmcmFzZVtzdHJsZW4oZnJhc2UpLTFdID09ICdcbicpIHsKICAgICAgICBmcmFzZVtzdHJsZW4oZnJhc2UpLTFdID0gJ1wwJzsKICAgIH0KCiAgICAvLyBPcmRlbmFuZG8gYSBmcmFzZQogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBzdHJsZW4oZnJhc2UpOyBpKyspIHsKICAgICAgICBmb3IgKGludCBvID0gMDsgbyA8IHN0cmxlbihmcmFzZSk7IG8rKykgewogICAgICAgICAgICBpZiAoZnJhc2VbaV0gPCBmcmFzZVtvXSkgewogICAgICAgICAgICAgICAgY2hhciB0ZW1wID0gZnJhc2VbaV07CiAgICAgICAgICAgICAgICBmcmFzZVtpXSA9IGZyYXNlW29dOwogICAgICAgICAgICAgICAgZnJhc2Vbb10gPSB0ZW1wOwogICAgICAgICAgICB9CiAgICAgICAgfSAgICAKICAgIH0KCiAgICAvLyBJbXByaW1pbmRvIG5hIHRlbGEgICAgCiAgICBjaGFyIGNhcmFjdGVyQXR1YWwgPSBmcmFzZVsxXTsKICAgIGludCBjb250YWRvciA9IDA7CiAgICBmb3IgKGludCBpID0gMTsgaSA8PSBzdHJsZW4oZnJhc2UpOyBpKyspIHsKICAgICAgICBpZiAoZnJhc2VbaV0gIT0gJyAnKSB7CiAgICAgICAgICAgIGlmIChmcmFzZVtpXSA9PSBjYXJhY3RlckF0dWFsKSB7CiAgICAgICAgICAgICAgICBjb250YWRvcisrOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgaWYgKGNhcmFjdGVyQXR1YWwgIT0gJyAnKSB7CiAgICAgICAgICAgICAgICAgICAgcHJpbnRmKCIlYyA9ICVkXG4iLCBjYXJhY3RlckF0dWFsLCBjb250YWRvcik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBjb250YWRvciA9IDE7CiAgICAgICAgICAgICAgICBjYXJhY3RlckF0dWFsID0gZnJhc2VbaV07CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9CiAgICAKICAgIHJldHVybiAwOwp9Cg==