Description
Problem 1. Censor Your Email Address
You have some text that contains your email address. You’re sick of spammers, so you want to hide it. You decide to replace all characters in it with asterisks (‘*’) except the domain. Assume the email address will always be in format [username]@[domain]; you’ll need to replace username with asterisks of equal length and keep the domain unchanged.
In the example below, your email is given on the first line and the text is given on the second line.
• Split the email into two parts – username and domain
• Create the replacement string by concatenating a string containing ‘*’ (with length equal to username.Length) with ‘@’ and the domain.
• Replace all occurrences of your email with the replacement string.
Input Output
pesho.peshev@email.bg
My name is Pesho Peshev. I am from Sofia, my email is: pesho.peshev@email.bg (not pesho.peshev@email.com). Test:
pesho.meshev@email.bg, pesho.peshev@email.bg My name is Pesho Peshev. I am from
Sofia, my email is: ************@email.bg (not pesho.peshev@email.com). Test:
pesho.meshev@email.bg, ************@email.bg
Reviews
There are no reviews yet.