ENG  RUSTimus Online Judge
Online Judge
Online contests
About Online Judge
Frequently asked questions
Site news
Problem set
Submit solution
Judge status
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests

Ural Championship 2011

About     Problems     Submit solution     Judge status     Standings
Contest is over

F. Swamp Doctor

Time limit: 3.0 second
Memory limit: 64 MB
During his recent trip to the center of the Zone, stalker Shtyr got into an earlier unknown anomaly. Things looked black — he started growing fangs and his eyes turned red. Now only the Swamp Doctor can save Shtyr from turning into a vampire…
Shtyr does not know the Doctor's email address but suggests that the address is stored in the pocket PC of the dead stalker Semetsky, which Shtyr has found recently. But the problem is that the shrewd Semetsky didn't use an address book but hid all the addresses in the contents of a big text file. Though Shtyr can read this file, he doesn't know which segment of the file is the Doctor's address.
Shtyr wants to find all segments of the text that can be addresses and send an email to each of them. How many emails will he send?
An email address in the vicinity of the Zone consists of a username and domain separated by the “@” symbol. The username and domain are nonempty strings consisting of lowercase English letters and dots. They cannot start or end with a dot and cannot contain two consecutive dots.


You are given the contents of the file from Semetsky's pocket PC. The file contains only symbols with ASCII codes from 32 to 126 and line breaks. The total size of the file is at most 106 bytes.


Output the number of different email addresses in Semetsky's file.




The file contains the following addresses: “a.b@c”, “a.b@c.d”, “b@c”, “b@c.d”, “b@c.de”.
Problem Author: Alexey Samsonov (prepared by Dmitry Ivankov and Ivan Burmistrov)
Problem Source: Ural Championship 2011
To submit the solution for this problem go to the Problem set: 1835. Swamp Doctor