function duplicateEncode(word){
let lowerCaseWord = word.toLowerCase(),
newWord = "";
for (let i = 0; i < word.length; i++) {
if (lowerCaseWord.lastIndexOf(lowerCaseWord[i]) == lowerCaseWord.indexOf(lowerCaseWord[i])) {
newWord += ")";
} else {
newWord += "(";
}
}
console.log(newWord);
}
function duplicateEncode(word){
let lowerCaseWord = word.toLowerCase(),
newWord = "";
for (let i = 0; i < word.length; i++) {
if (lowerCaseWord.lastIndexOf(lowerCaseWord[i]) == lowerCaseWord.indexOf(lowerCaseWord[i])) {
newWord += ")";
} else {
newWord += "(";
}
}
return newWord;
}