Skip to content

Instantly share code, notes, and snippets.

@risingBirdSong
Created December 31, 2019 00:15
Show Gist options
  • Save risingBirdSong/eb20e9f8d4a4b51387a64f6b57a531bc to your computer and use it in GitHub Desktop.
Save risingBirdSong/eb20e9f8d4a4b51387a64f6b57a531bc to your computer and use it in GitHub Desktop.
function duplicateEncode(word){
return word
.toLowerCase()
.split('')
.map( function (a, i, w) {
return w.indexOf(a) == w.lastIndexOf(a) ? '(' : ')'
})
.join('');
}
//my solution worked but i like this better, from another code warrior
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment