#include <bits/stdc++.h>
using namespace std;
struct ASDF {
  ASDF& operator,(int& a) {
    scanf("%d", &a);
    return *this;
  }
  ASDF& operator,(long int& a) {
    scanf("%ld", &a);
    return *this;
  }
  ASDF& operator,(long long int& a) {
    scanf("%lld", &a);
    return *this;
  }
  ASDF& operator,(char& c) {
    scanf("%c", &c);
    return *this;
  }
  ASDF& operator,(double& d) {
    scanf("%lf", &d);
    return *this;
  }
  template <typename T>
  ASDF& operator,(T& a) {
    cin >> a;
    return *this;
  }
} asdf;
template <typename T>
ostream& operator<<(ostream& output, vector<T>& v) {
  output << "[ ";
  if (int(v.size())) {
    output << v[0];
  }
  for (int i = 1; i < int(v.size()); i++) {
    output << ", " << v[i];
  }
  output << " ]";
  return output;
}
template <typename T1, typename T2>
ostream& operator<<(ostream& output, pair<T1, T2>& p) {
  output << "( " << p.first << ", " << p.second << " )";
  return output;
}
int main() {
  string ss;
  cin >> ss;
  long long cnt = 0;
  for (int i = 0; i < int(ss.size()); i++) {
    if (ss[i] == '@') {
      long long p, q;
      p = q = 0;
      int j;
      for (j = i - 1; j > -1; j--) {
        if ('a' <= ss[j] && ss[j] <= 'z') {
          p++;
        } else if (!(ss[j] == '_' || ('0' <= ss[j] && ss[j] <= '9'))) {
          break;
        }
      }
      if (ss[i + 1] == '.') {
        q = -1;
      }
      for (j = i + 1; j < int(ss.size()); j++) {
        if (ss[j] == '.') {
          break;
        }
        if (!(('0' <= ss[j] && ss[j] <= '9') ||
              ('a' <= ss[j] && ss[j] <= 'z'))) {
          q = -1;
          break;
        }
      }
      if (q == -1) {
        q = 0;
      } else {
        for (j++; j < int(ss.size()); j++) {
          if ('a' <= ss[j] && ss[j] <= 'z') {
            q++;
          } else {
            break;
          }
        }
      }
      cnt += p * q;
    }
  }
  cout << cnt << endl;
}
