Javascript. Restrict the user to input the same number characters as in the textbox
<p>I will flash a scrambled word and then the user will type in what the scrambled word is.</p>

<p>So far I have this code. This is for shuffle and display.</p>

<pre><code>document.getElementById("shuffle").value = shuffle(document.getElementById("word").value);
var shuffledword = document.getElementById("shuffle").value;
var z = shuffledword.split("").join('&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;');
var x=document.getElementById("demo");
x.innerHTML=z;

var str=document.getElementById("demo").innerHTML; 
var n=str.replace(charcode,"...");
document.getElementById("demo").innerHTML=n;
</code></pre>

<p>What I want is to restrict the user to input the same number letters as in the shuffled word. Example: the word is "DOOMED"; I want to make it so that the user cannot click the letter D and O three times, but only once or twice. Same for the other letters, depending on the number letters in the shuffled word. </p>

<p>It this possible?</p>
