#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-9;
const int inf = (1 << 30) - 1;
const long long inf64 = ((long long)1 << 62) - 1;
const long double pi = acos(-1);
template <class T>
T sqr(T x) {
  return x * x;
}
template <class T>
T abs(T x) {
  return x < 0 ? -x : x;
}
const int MAXN = 1100 * 1000;
string s;
int ad[MAXN], pt[MAXN];
int main() {
  cin >> s;
  int n = s.length();
  int n_ad = 0;
  int n_pt = 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] == '@') {
      ad[n_ad] = i;
      n_ad++;
    } else if (s[i] == '.') {
      pt[n_pt] = i;
      n_pt++;
    }
  }
  ad[n_ad] = n + 100;
  long long ans = 0;
  int it_pt = 0;
  for (int i = 0; i < n_ad; ++i) {
    while (it_pt < n_pt && pt[it_pt] < ad[i]) it_pt++;
    if (it_pt == n_pt || pt[it_pt] > ad[i + 1] || pt[it_pt] == ad[i] + 1)
      continue;
    bool key = true;
    for (int j = ad[i] + 1; j < pt[it_pt]; ++j) {
      if (s[j] == '_') {
        key = false;
        break;
      }
    }
    if (!key) continue;
    int left = 0;
    int j = ad[i] - 1;
    while (j >= 0 && s[j] != '@' && s[j] != '.') {
      if (s[j] >= 'a' && s[j] <= 'z') left++;
      j--;
    }
    int right = 0;
    j = pt[it_pt] + 1;
    while (j < n && s[j] >= 'a' && s[j] <= 'z') {
      right++;
      j++;
    }
    ans += ((long long)left) * right;
  }
  cout << ans << endl;
  return 0;
}
