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