#include <bits/stdc++.h>
using namespace std;
int findNextNot(int p, string &A) {
  while (p < A.size() && A[p] != '@' && A[p] != '.') p++;
  return p;
}
int findNextAt(int p, string &A) {
  while (p < A.size() && A[p] != '@') p++;
  return p;
}
int findNextDot(int p, string &A) {
  while (p < A.size() && A[p] != '.') p++;
  return p;
}
int findPrevAt(int p, string &A) {
  while (p >= 0 && A[p] != '@') p--;
  return p;
}
int main() {
  string S;
  cin >> S;
  int PP = 0;
  long long CNT = 0;
  while (true) {
    bool valid = 1;
    int nA = findNextAt(PP, S);
    if (nA == S.size()) break;
    int nD = findNextDot(nA + 1, S);
    if (nD == S.size()) break;
    nA = findPrevAt(nD, S);
    int cntF = 0, cntS = 0;
    for (int i = nA - 1; i >= 0; --i) {
      if (S[i] == '@' || S[i] == '.') break;
      if ((S[i] >= 'a' && S[i] <= 'z')) cntF++;
    }
    for (int i = nA + 1; i < nD; ++i)
      if (S[i] == '.' || S[i] == '@' || S[i] == '_') valid = 0;
    valid = valid && (nA + 1 != nD);
    for (int i = nD + 1; i < S.size(); ++i) {
      if (S[i] >= 'a' && S[i] <= 'z')
        cntS++;
      else
        break;
    }
    if (valid) {
      CNT += 1LL * cntF * cntS;
    }
    PP = nD + 1;
  }
  cout << CNT << endl;
}
