CF31B.Sysadmin Bob

普及/提高-

通过率:0%

时间限制:0.50s

内存限制:256MB

AC君温馨提醒

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

题目描述

Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.

Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.

Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.

Berland 中的电子邮件地址是一个形如 A@B 的字符串,其中 A 和 B 是由小写拉丁字母组成的任意字符串。

Bob 是 «Bersoft» 公司的一名系统管理员。他维护着公司员工电子邮件地址的列表。该列表以一个长字符串的形式存储,其中所有地址以任意顺序书写,并用逗号分隔。同一地址可能出现多次。

突然,由于未知原因,Bob 列表中的所有逗号都消失了。现在 Bob 得到一个字符串,其中所有地址依次连接在一起,中间没有任何分隔符,因此无法确定各地址之间的边界。不幸的是,就在同一天,他的主管要求他提交原始的地址列表。现在 Bob 希望以某种合法的方式将该字符串拆分为若干电子邮件地址。请帮助他完成这项任务。

输入格式

The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».

第一行包含无分隔符的地址列表。该字符串的长度在 1 到 200 之间(含端点)。字符串仅由小写拉丁字母和字符 «@» 组成。

输出格式

If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.

如果不存在一个由合法(根据 Berland 规则)的电子邮件地址组成的列表,使得将该列表中所有逗号删除后与给定字符串完全一致,则输出 No solution。否则,输出该列表。同一地址在该列表中可出现多次。若存在多种解,输出任意一种即可。

输入输出样例

  • 输入#1

    a@aa@a

    输出#1

    a@a,a@a
  • 输入#2

    a@a@a

    输出#2

    No solution
  • 输入#3

    @aa@a

    输出#3

    No solution

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

首页