CF21A.Jabber ID

普及+/提高

通过率:0%

时间限制:0.50s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Jabber ID on the national Berland service «Babber» has a form @[/resource], where

  • — is a sequence of Latin letters (lowercase or uppercase), digits or underscores characters «_», the length of is between 1 and 16, inclusive.
  • — is a sequence of word separated by periods (characters «.»), where each word should contain only characters allowed for , the length of each word is between 1 and 16, inclusive. The length of is between 1 and 32, inclusive.
  • — is a sequence of Latin letters (lowercase or uppercase), digits or underscores characters «_», the length of is between 1 and 16, inclusive.

The content of square brackets is optional — it can be present or can be absent.

There are the samples of correct Jabber IDs: [email protected], [email protected]/contest.

Your task is to write program which checks if given string is a correct Jabber ID.

国家贝尔兰服务「Babber」上的 Jabber ID 格式为 <username>@<hostname>[/resource],其中:

  • <username> —— 是由拉丁字母(大小写均可)、数字或下划线字符 \_ 组成的序列,<username> 的长度在 1 到 16(含)之间。
  • <hostname> —— 是由点号(字符 .)分隔的若干单词组成的序列,每个单词仅能包含与 <username> 相同的字符,且每个单词的长度在 1 到 16(含)之间;整个 <hostname> 的长度在 1 到 32(含)之间。
  • <resource> —— 是由拉丁字母(大小写均可)、数字或下划线字符 \_ 组成的序列,<resource> 的长度在 1 到 16(含)之间。

方括号 [ ] 中的内容是可选的——可以存在,也可以不存在。

以下是合法 Jabber ID 的示例:[email protected],[email protected]/contest。

你的任务是编写一个程序,判断给定字符串是否为合法的 Jabber ID。

输入格式

The input contains of a single line. The line has the length between 1 and 100 characters, inclusive. Each characters has ASCII-code between 33 and 127, inclusive.

输入仅包含一行。该行长度在 1 到 100 个字符之间(含端点)。每个字符的 ASCII 码在 33 到 127 之间(含端点)。

输出格式

Print YES or NO.

输出 YES 或 NO。

输入输出样例

  • 输入#1

    [email&#160;protected]

    输出#1

    YES
  • 输入#2

    [email&#160;protected]/contest.icpc/12

    输出#2

    NO

输入解题思路,AI测评打分。不知道怎么写?

首页