题目描述
Problem Description
You are trying to create a certain SNS.
In this SNS, it is possible to send messages to specific users in the format @username, and by specifying multiple users in one post, it is possible to send messages to multiple users simultaneously.
This SNS follows the following rules:
- The posted messages contain only lowercase alphabets, spaces, and
@. - If a posted message contains
@, the longest string consisting only of alphabets immediately following@is treated as the username and the message is delivered to that user. - If the character immediately following
@is not an alphabet, it is ignored. - Even if the same user is specified multiple times, the message only needs to be delivered once.
To implement this system, you want to create a program that lists the users to whom the posted message should be delivered.
Output all users who should receive the message. If there are multiple users, output them in lexicographical order.
Input Format
The input is given from the standard input in the following format:
$ S $
- The first line contains a string $ S $ representing the posted message ($1 \leq |S| \leq 140$).
- The string $ S $ does not contain any characters other than lowercase alphabets, spaces, and
@.
Output Format
Output all users who should receive the message, one per line. If there are multiple users, output them in lexicographical order.
Sample Input and Output
Sample Input #1
@codeformula why is this contest so easy
Sample Output #1
codeformula
Sample Input #2
myon @@c @a @aba@a @@bb bbb @@@@@ @a test @ space aaa test @a@a test@takoyaki
Sample Output #2
a
aba
bb
c
takoyaki
Sample Input #3
no atmark
Sample Output #3
Notes/Hints
Sample Explanation 1
This is a message for codeformula. Since there is a space after codeformula, the part after why is not recognized as a username. Also, there is no need to output @.
Sample Explanation 2
Although a is specified multiple times, it only needs to be output once. Also, usernames need to be output in lexicographical order.
Sample Explanation 3
If there are no users to whom the message should be delivered, nothing needs to be output.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分