#include <bits/stdc++.h>
using namespace std;
const int maxN = 2000002;
string s;
long long ans, n;
long long R(int i) {
  int k = 0;
  i++;
  while (i < n && s[i] != '.' && s[i] != '_' && s[i] != '@') {
    i++;
    k = 1;
  }
  if (s[i] != '.' || !k) return 0;
  i++;
  k = i;
  while (i < n && s[i] <= 'z' && s[i] >= 'a') i++;
  return i - k;
}
long long L(int i) {
  int k = 0;
  i--;
  while (i >= 0 && s[i] != '.' && s[i] != '@') {
    k += s[i] >= 'a' && s[i] <= 'z';
    i--;
  }
  return k;
}
int main() {
  cin >> s;
  n = s.size();
  s += "^_^";
  for (int i = 0; i < n; i++)
    if (s[i] == '@') ans += L(i) * R(i);
  cout << ans << endl;
}
