Checking email format using a regular expression

PHP Easy regex

Task «Checking email format using a regular expression»

Write a PHP program that reads a string from standard input and checks whether it matches a simple email pattern: local part (Latin letters, digits, dots, underscores, hyphens), then the '@' symbol, then the domain name (Latin letters, digits, dots, hyphens), then a dot and a top-level domain (from 2 to 6 Latin letters). Output 'Yes' if the string is a valid email, and 'No' otherwise. The string length does not exceed 100 characters.

Input Format

One line containing a potential email address.

Output Format

String 'Yes' or 'No'.

Examples

Example 1

INPUT
user@example.com
OUTPUT
Yes

Example 2

INPUT
test.email@domain.co
OUTPUT
Yes

Example 3

INPUT
1 2 3 4 5 6
OUTPUT
No

Example 4

INPUT
invalid-email@
OUTPUT
No

Example 5

INPUT
4 0 0 0 2 2 2 2 0
OUTPUT
No
main.php