#222 · Strings · Beginner · 30 XP · about 5 min
Account pages often show an email address partly hidden, so its owner can recognise it while a stranger looking at the screen cannot read it. Write mask_email(email) that returns the address with its name part (everything before the @) masked like this:
*.*.*.The @ and everything after it stay exactly as they are.
mask_email('jane.doe@mail.com') # returns 'j******e@mail.com' mask_email('sam@home.net') # returns 's*m@home.net' mask_email('bo@site.org') # returns 'b*@site.org' mask_email('x@y.io') # returns '*@y.io'
Every address contains exactly one @, with at least one character on each side of it.
First solves only, ranked by stars and then time.