#include <bits/stdc++.h>
using namespace std;
const int nmax = 1e6 + 3;
const long double pi = M_PI;
const int inf = 1000 * 1000 * 1000;
const int mod = 1000 * 1000 * 1000 + 7;
string s;
long long answer = 0;
int main() {
  getline(cin, s);
  for (int i = 0; i < s.length(); i++) {
    if (s[i] != '@') continue;
    long long ans1 = 0, ans2 = 0;
    for (int j = i - 1; j >= 0 && ((s[j] >= 'a' && s[j] <= 'z') ||
                                   (s[j] >= '0' && s[j] <= '9') || s[j] == '_');
         j--)
      ans1 += ((s[j] >= 'a' && s[j] <= 'z') ? 1 : 0);
    bool f = true;
    int col = 0, ind = i + 1;
    while (ind < s.length() && s[ind] != '.') {
      if (!((s[ind] >= 'a' && s[ind] <= 'z') ||
            (s[ind] >= '0' && s[ind] <= '9'))) {
        f = false;
        break;
      }
      ind++;
      col++;
    }
    if (!f || col == 0 || ind == s.length()) continue;
    for (int j = ind + 1; j < s.length() && (s[j] >= 'a' && s[j] <= 'z'); j++)
      ans2++;
    answer += ans1 * ans2;
  }
  cout << answer;
}
