#C3980. Email Validation

    ID: 47467 Type: Default 1000ms 256MiB

Email Validation

Email Validation

Problem Statement:

You are given an email address and you need to determine if it is valid according to the following criteria:

1. The email must contain exactly one '@' symbol.
2. The local part (the part before '@') may contain letters, digits, dots ('.') and underscores ('_'), but it cannot start or end with a dot.
3. The domain part (the part after '@') must contain letters, digits, and dots. It must contain at least one dot, cannot start or end with a dot, and cannot have consecutive dots.
4. In addition, the email should conform to the regular expression
( [1]+@[a-zA-Z0-9]+.[a-zA-Z0-9.]*[a-zA-Z0-9]+$ ).

Your task is to read an email address from standard input and output True if the email is valid according to these criteria, and False otherwise.

inputFormat

The input consists of a single line containing an email address.

outputFormat

Output a single line: True if the email is valid, and False otherwise.## sample

user.name@domain.com
True

  1. a-zA-Z0-9._ ↩︎