Challenge: Hide the Email
Completed
To protect privacy, websites often hide part of an email address. Read an email and print it with everything before the @ hidden, except the first letter. Replace each hidden letter with *.
Input
One email address, e.g. asha@example.com.
Output
The masked email, e.g. a***@example.com.
Example
Input
asha@example.com
Output
a***@example.com
Editor
Python
Hints
email.find("@") tells you where the @ is.
"*" * n repeats a star n times.
email[at:] is everything from the @ to the end.
Solution explanation
The part before the @ has at characters. We keep the first one and replace the other at - 1 with stars, then add the rest of the email.
Show solution
email = input()
at = email.find("@")
print(email[0] + "*" * (at - 1) + email[at:])