contact is either an e-mail address or a phone number. Return its masked version.
An **e-mail** looks like name@domain: the name is made of English letters and may contain ., - and _ inside (its first and last characters are letters), the domain of English letters and dots (a dot never starts or ends the domain and never follows another dot). To mask it:
- turn every letter lowercase;
- keep only the first and last letters of the name and replace everything between them with exactly five asterisks *****, however long the name is. A one-letter name counts that letter as both first and last: [email protected] becomes a*****[email protected].
A **phone number** has 10 to 13 digits, possibly separated by +, -, (, ) and spaces. The last 10 digits are the local number; the 0 to 3 digits before them are the country code. To mask it, drop the separators and write the result as:
- ***-***-XXXX when there is no country code;
- +*-***-***-XXXX, +**-***-***-XXXX or +***-***-***-XXXX when the country code has 1, 2 or 3 digits.
Here XXXX stands for the last four digits of the number.contact="[email protected]" → 'm*****[email protected]'
This is an e-mail. Everything goes lowercase, and the name masha.petrova keeps only its first and last letters with exactly five asterisks between them.
contact="+44 (20) 7946-0018" → '+**-***-***-0018'
This is a phone number with 12 digits, so the country code has 2 digits. Only the last four digits, 0018, stay visible.
contact="(495) 123-45-67" → '***-***-4567'
Exactly 10 digits means there is no country code, so no leading plus.
contact is a valid e-mail or phone number as described abovecontact="[email protected]"
'm*****[email protected]'
Run checks the first 3 tests in your browser. Submit checks all 151 tests on the server, hidden ones included.