JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" name="nome" id="nome" value="" />
<div id="teste"></div>

JavaScript

$("#nome").on("keyup", function(){
    var qtdLetrasRepetidas = parseInt( $(this).val().match(/(.).*\1/).length );

    $("#teste").html(qtdLetrasRepetidas);
});