#include <bits/stdc++.h>
using namespace std;
int main() {
  string addr;
  cin >> addr;
  int n = addr.length();
  int lastAtSign = -1;
  int curAtSign = addr.find('@', lastAtSign + 1);
  long long res = 0;
  while (curAtSign != -1) {
    int curS = curAtSign;
    int idxPoint = -1;
    while (++curS < n) {
      if (addr[curS] == '.') {
        idxPoint = curS;
        break;
      }
      if (!isalnum(addr[curS])) break;
    }
    long long rc = 0;
    if (idxPoint != -1 && (idxPoint != curAtSign + 1)) {
      curS = idxPoint;
      while (++curS < n) {
        if (!isalpha(addr[curS])) break;
        rc++;
      }
    }
    if (rc != 0) {
      long long lc = 0;
      curS = curAtSign;
      while (--curS >= 0) {
        if (!isalnum(addr[curS]) && addr[curS] != '_') break;
        if (isalpha(addr[curS])) lc++;
      }
      res += (lc * rc);
    }
    lastAtSign = curAtSign;
    curAtSign = addr.find('@', lastAtSign + 1);
  }
  cout << res << endl;
  return 0;
}
