Question
Mask email addresses in a log line to avoid leaking PII. Given a `text` string, replace every email address with a masked form that keeps the first character of the local part, replaces the rest of the local part with '*' (one star per hidden character), and leaves the '@domain' intact. An email is a run matching local@domain.tld where local is [A-Za-z0-9._%+-]+, domain is [A-Za-z0-9.-]+, and tld is at least 2 letters. If the local part is a single character, mask it entirely. Text with no emails is returned unchanged.
mask_emails(text: str) → str["Contact alice@example.com now"]out"Contact a****@example.com now"State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.