2022-10-27 15:07:13 +00:00
|
|
|
export function mostUsedChar(text) {
|
2022-10-30 19:26:43 +00:00
|
|
|
// implementar logica aqui
|
|
|
|
let cont = 0,
|
|
|
|
maior = 0;
|
2022-10-29 15:59:29 +00:00
|
|
|
|
2022-10-30 19:26:43 +00:00
|
|
|
let resp = text.toLowerCase();
|
2022-10-29 15:59:29 +00:00
|
|
|
|
2022-10-30 19:26:43 +00:00
|
|
|
let i = 0,
|
|
|
|
j = 0;
|
|
|
|
for (i = 0; i < text.length; i++) {
|
|
|
|
cont = 0;
|
|
|
|
for (j = 0; j < text.length; j++) {
|
|
|
|
if (resp[i] == text[j]) {
|
|
|
|
cont++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (maior < cont) {
|
|
|
|
maior = cont;
|
|
|
|
var resposta = resp[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return resposta;
|
|
|
|
}
|