#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000003;
string s;
vector<string> mat;
vector<char> cmat;
int cond[maxn][3];
int main() {
  cin >> s;
  string cur = "";
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '.' || s[i] == '@') {
      mat.push_back(cur);
      cmat.push_back(s[i]);
      cur = "";
    } else
      cur += s[i];
  }
  mat.push_back(cur);
  for (int i = 0; i < mat.size(); i++) {
    string sc = mat[i];
    int sz = sc.size();
    for (int j = 0; j < sz; j++) {
      if (!('0' <= sc[j] && sc[j] <= '9') && sc[j] != '_') cond[i][0]++;
    }
    bool ok = true;
    for (int j = 0; j < sz; j++) {
      if (sc[j] == '_') {
        ok = false;
        break;
      } else
        cond[i][1]++;
    }
    if (!ok) cond[i][1] = 0;
    for (int j = 0; j < sz; j++) {
      if (!('0' <= sc[j] && sc[j] <= '9') && sc[j] != '_') {
        cond[i][2]++;
      } else
        break;
    }
  }
  long long ans = 0;
  for (int i = 0; i + 2 < mat.size(); i++) {
    if (cond[i][0] && cond[i + 1][1] && cond[i + 2][2] && cmat[i] == '@' &&
        cmat[i + 1] == '.') {
      long long a = cond[i + 2][2];
      long long b = cond[i][0];
      ans += a * b;
    }
  }
  cout << ans;
}
