문제 링크 : Unique Email Addresses
/**
* @param {string[]} emails
* @return {number}
*/
var numUniqueEmails = function(emails) {
return new Set(emails.map(e => {
const splitEmail = e.split('@')
const plusIdx = splitEmail[0].indexOf('+')
if(plusIdx > 0) {
splitEmail[0] = splitEmail[0].substr(0,plusIdx)
}
splitEmail[0] = splitEmail[0].replaceAll('.', '')
return splitEmail.join('@')
})).size
};