function duplicateCount(text){
var lowerCaseText = text.toLowerCase();
var repeats = 0;
for (i=0; i<lowerCaseText.length; i++) {
for (b=0; b<lowerCaseText.length; b++) {
if (lowerCaseText[b] === lowerCaseText[b+1]) {
repeats = repeats + 1;
lowerCaseText = lowerCaseText.replace(lowerCaseText[b],"")
break;
}}}
return repeats;
}
if (lowerCaseText[b] === lowerCaseText[b+1]) {
function duplicateCount(text){
text = text.toLowerCase();
var len = text.length
, chars = Object.create(null)
, char
, count = 0
;
for(i=0; i<len; i++){
char = text[i];
if(chars[char] == undefined){
chars[char] = false;
} else {
chars[char] = true;
}
}
for(c in chars){
if(chars[c]){
count++;
}
}
return count;
}