#include <bits/stdc++.h>
using namespace std;
inline bool letter(char c) {
  return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
}
inline bool digit(char c) { return c >= '0' && c <= '9'; }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long ans = 0;
  int it1 = 0, it2 = 0, it3 = 0;
  string S;
  getline(cin, S);
  int n = S.size();
  for (; it2 != n; it2++) {
    if (S[it2] == '@') {
      it3 = it2 + 1;
      while (it3 < n && (letter(S[it3]) || digit(S[it3]))) it3++;
      if (it3 != n && S[it3] == '.' && it3 != it2 + 1) {
        int num = it3 + 1;
        while (num < n && letter(S[num])) num++;
        int t = 0;
        for (int i = it1; i < it2; i++) t += letter(S[i]);
        ans += (long long)t * (num - it3 - 1);
      }
      it1 = it2 + 1;
      while (it1 < n && !letter(S[it1])) it1++;
    } else if (!letter(S[it2]) && !digit(S[it2]) && S[it2] != '_')
      it1 = it2 + 1;
  }
  cout << ans;
  return 0;
}
