#include <bits/stdc++.h>
using namespace std;
const long long SZ = 1e6 + 100;
long long pr1[SZ], pr2[SZ];
long long s1[SZ], s2[SZ];
long long get1(long long l) {
  if (l < 0) {
    return 0;
  }
  return s1[l];
}
long long get2(long long l) {
  if (l < 0) {
    return 0;
  }
  return s2[l];
}
pair<long long, long long> getsum(long long l, long long r) {
  return make_pair(get1(r) - get1(l - 1), get2(r) - get2(l - 1));
}
int main() {
  string s;
  cin >> s;
  long long n = (long long)s.size();
  for (long long i = 0; i < n; i++) {
    if (s[i] >= '0' && s[i] <= '9') {
      pr1[i] = 1;
    }
    if (s[i] == '_' || s[i] == '.' || s[i] == '@') {
      pr2[i] = 1;
    }
    if (i) {
      s1[i] = s1[i - 1];
      s2[i] = s2[i - 1];
    }
    s1[i] += pr1[i];
    s2[i] += pr2[i];
  }
  long long lasta = -1, lastp = -1;
  long long k = 0;
  long long p = 0, p2 = 0;
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    if (s[i] >= 'a' && s[i] <= 'z') {
      p++;
    }
    if (s[i] == '@') {
      lasta = i;
      p2 = k;
      k = p;
      p = 0;
    }
    if (s[i] == '.') {
      lastp = i;
      p2 = k;
      k = p;
      p = 0;
    }
    if (s[i] >= 'a' && s[i] <= 'z' && lastp - lasta > 1 && lasta != -1) {
      pair<long long, long long> t1 = getsum(lasta + 1, lastp - 1);
      pair<long long, long long> t2 = getsum(lastp + 1, i);
      if (t1.second == 0 && t2.first == 0 && t2.second == 0) {
        ans += p2;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
