Coder-Strike 2014 - Round 1
E
E-mail Addresses
Codeforces
1900
原题
← D→
翻译中…

One of the most important products of the R1 company is a popular @r1.com mail service. The R1 mailboxes receive and send millions of emails every day.

翻译中…

Today, the online news thundered with terrible information. The R1 database crashed and almost no data could be saved except for one big string. The developers assume that the string contains the letters of some users of the R1 mail. Recovering letters is a tedious mostly manual work. So before you start this process, it was decided to estimate the difficulty of recovering. Namely, we need to calculate the number of different substrings of the saved string that form correct e-mail addresses.

翻译中…

We assume that valid addresses are only the e-mail addresses which meet the following criteria:

翻译中…
  • the address should begin with a non-empty sequence of letters, numbers, characters '_', starting with a letter;
  • then must go character '@';
  • then must go a non-empty sequence of letters or numbers;
  • then must go character '.';
  • the address must end with a non-empty sequence of letters.
翻译中…

You got lucky again and the job was entrusted to you! Please note that the substring is several consecutive characters in a string. Two substrings, one consisting of the characters of the string with numbers $*l*_{1}, *l*_{1} + 1, *l*_{1} + 2, ..., *r*_{1}$ and the other one consisting of the characters of the string with numbers $*l*_{2}, *l*_{2} + 1, *l*_{2} + 2, ..., *r*_{2}$, are considered distinct if $*l*_{1} ≠ *l*_{2}$ or $*r*_{1} ≠ *r*_{2}$.

翻译中…

Input

翻译中…

The first and the only line contains the sequence of characters $*s*_{1}*s*_{2}... *s*_{*n*}$ $(1 ≤ *n* ≤ 10^{6})$ — the saved string. It is guaranteed that the given string contains only small English letters, digits and characters '.', '_', '@'.

翻译中…

Output

翻译中…

Print in a single line the number of substrings that are valid e-mail addresses.

翻译中…

Note

翻译中…

In the first test case all the substrings that are correct e-mail addresses begin from one of the letters of the word agapov and end in one of the letters of the word com.

翻译中…

In the second test case note that the e-mail x@x.x is considered twice in the answer. Note that in this example the e-mail entries overlap inside the string.

翻译中…

样例

Input #1
gerald.agapov1991@gmail.com
Output #1
18
InputCopy OutputCopy
Input #2
x@x.x@x.x_e_@r1.com
Output #2
8
InputCopy OutputCopy
Input #3
a___@1.r
Output #3
1
InputCopy OutputCopy
Input #4
.asd123__..@
Output #4
0
InputCopy OutputCopy
题目信息
题号
412E
时间限制
1 s
内存限制
256 MB
标签
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。