#K49132. Valid Email Checker
Valid Email Checker
Valid Email Checker
You are given an email address as input. Your task is to determine whether the email is valid according to the following criteria:
- The email must contain exactly one '@' character, i.e. $$\#('@') = 1$$.
- The email is split into a local part (before the '@') and a domain part (after the '@'). Neither part may be empty.
- The domain part must contain at least one '.' character, i.e. $$\#('.') \ge 1$$.
- The local part must consist only of alphanumeric characters and the special characters
.
,_
,-
, and+
. - The domain part must consist only of alphanumeric characters, the dot
.
and the hyphen-
. - Both the local part and the domain part must start and end with an alphanumeric character.
For example, the email john.doe@example.com
is valid, but .jane_doe@example.com
is not valid because the local part does not start with an alphanumeric character.
inputFormat
The input consists of a single line containing a string which represents the email address to be validated.
You should read the input from the standard input (stdin).
outputFormat
Output a single line: True
if the email is valid based on the criteria, and False
otherwise.
The output should be written to the standard output (stdout).
## samplejohn.doe@example.com
True