Hide

Problem I
Email Addresses

/problems/emailaddresses/file/statement/en/img-0001.jpg
Mail

You have started your own company and are creating a Software-as-a-Service solution for tracking missing socks, called where-my-sock.is. You are currently in a beta phase. People who are interested in using the product need to sign up with an email address in order to receive an invite.

You have set up an error monitoring system so that you are notified whenever an error occurs in your software system. Recently, you have noticed several errors from the email system that sends out the invites. You investigate and discover that a surprisingly large portion of people trying to sign up misspell their email address when they fill out the signup form. The service you use to send the email messages is very picky about email addresses conforming to specification. This is a bit of a shame because these users are not made aware of their mistake and instead end up refreshing their inboxes, never receiving the invite they crave so much.

You decide to do something about this.
You look at the error logs and compile a list of the $8$ most common mistakes people make. They are:

  1. $@$ symbol is missing.

  2. There are multiple $@$ symbols.

  3. There is nothing before the $@$ symbol.

  4. There is nothing after the $@$ symbol.

  5. Email address starts with a dot.

  6. There is a dot just before the $@$ symbol.

  7. There are consecutive dots.

  8. The top-level-domain (e.g. .com) is missing.

You intend to add a validator to the signup form to provide a helpful message to users when they make one of these mistakes, but first you create a prototype in your favourite programming language Python.

Input

Input consists of one line that includes the email address that should be checked.

Output

Output consists of an explanation of what is wrong with the email according to the rules above or the phrase All good. if nothing is wrong. The rules should be validated in the same order as stated above.

Explanation of samples

Sample outputs $1-8$ correspond to the expected output for the most common mistakes $1-8$.

Sample Input 1 Sample Output 1
richard.where-my-sock.is
@ symbol is missing.
Sample Input 2 Sample Output 2
richard@where-my-sock@is
richard@where-my-sock@is
                     ^--there is an extra @ symbol here.
Sample Input 3 Sample Output 3
@where-my-sock.is
There is nothing before the @ symbol.
Sample Input 4 Sample Output 4
richard@
richard@
        ^--there is nothing after the @ symbol.
Sample Input 5 Sample Output 5
.richard.hendricks@where-my-sock.is
Email address starts with a dot.
Sample Input 6 Sample Output 6
richard.hendricks.@where-my-sock.is
richard.hendricks.@where-my-sock.is
                 ^--there is an extra dot here.
Sample Input 7 Sample Output 7
richard..hendricks@where-my-sock.is
richard..hendricks@where-my-sock.is
       ^--there are consecutive dots here.
Sample Input 8 Sample Output 8
richard.hendricks@where-my-sock
Top-level-domain is missing.
Sample Input 9 Sample Output 9
richard.hendricks@where-my-sock.is
All good.

Please log in to submit a solution to this problem

Log in