#C961. Email Address Validation
Email Address Validation
Email Address Validation
You are given a list of email addresses. Your task is to validate each email address based on the following rules:
- The email must start with an alphabetic character.
- It must contain exactly one
@
symbol. - The domain (i.e. the part after the
@
) must be at least two characters long. Furthermore, if the domain contains a dot, the segment after the last dot must be at least two characters long (i.e. \(\ge 2\)). - The email cannot contain any spaces or special characters other than
.
,_
, and-
.
For each email address, output True
if it satisfies all the rules, and False
otherwise.
inputFormat
The first line of input contains an integer \(n\) denoting the number of email addresses. Each of the next \(n\) lines contains one email address.
outputFormat
For each email address, print True
or False
on a separate line indicating whether the email address is valid.
3
john.doe@domain.com
1invalid@domain.com
alice@site
True
False
True
</p>