[Java/Python 3] 7 and 6 liners with comment and analysis.
java\n    public int numUniqueEmails(String[] emails) {\n        Set<String> normalized = new HashSet<>(); // used to save simplified email address, cost O(n) s
```java\n    public int numUniqueEmails(String[] emails) {\n        Set<String> normalized = new HashSet<>(); // used to save simplified email address, cost O(n) sapce.\n        for (String email : emails) {\n            String[] parts = email.split("@"); // split into local and domain parts.\n            String[] local = parts[0].split("\\\\+"); // split local by \'+\'.\n            normalized.add(local[0].replace(".", "") + "@" + parts[1]); // remove all \'.\', and concatenate \'@\' and domain.        \n        }\n        return normalized.size();\n    }\n```\n```python\n    def numUniqueEmails(self, emails: List[str]) -> int:\n        seen = set()\n        for email in emails:\n            name, domain = email.split(\'@\') \n            local = name.split(\'+\')[0].replace(\'.\', \'\')\n            seen.add(local + \'@\' + domain)\n        return len(seen)\n```\n**Analysis**\nLet `n` be the total characters in the input array `emails`. The HashSet `normalized` and the for loop both cost `O(n)`, in terms of space and time, respectively. \n\n**Time & space: O(n).**\n# --------------------\n\n**Q & A**\n\n**Q1**: What is Java metacharacter?\n**A1**: A metacharacter \u2014 a character with special meaning interpreted by the Java regular expression engine / matcher.\nhttps://en.wikipedia.org/wiki/Metacharacter\nhttps://docs.oracle.com/javase/tutorial/essential/regex/literals.html. \n\n**Q2**: Why does Java regular expression use `\\\\`, instead of `\\`, to escape metacharacter such as `+, ., *`, etc?\n\n**A2**: I guess the reason is that the backslash character is an escape character in Java String literals already. \n\n**Update:**\n\nCredit to @helengu1996 for her [link](https://stackoverflow.com/a/25145826/4150692):\n\n*"There are two "escapings" going on here. The first backslash is to escape the second backslash for the Java language, to create an actual backslash character. The backslash character is what escapes the + or the s for interpretation by the regular expression engine. That\'s why you need two backslashes -- one for Java, one for the regular expression engine. With only one backslash, Java reports \\s and \\+ as illegal escape characters -- not for regular expressions, but for an actual character in the Java language."*\n\n----\n\nSimilar solution:\n\n[1592. Rearrange Spaces Between Words](https://leetcode.com/problems/rearrange-spaces-between-words/discuss/855335/JavaPython-3-6-liners.)
[]