#include <bits/stdc++.h>
using namespace std;
string s;
long long ans, a;
int main() {
  cin >> s;
  for (int i = 0; i < s.length(); ++i)
    if (s[i] >= 'a' && s[i] <= 'z')
      ++a;
    else if (s[i] == '.')
      a = 0;
    else if (s[i] == '@') {
      int j = ++i;
      while (((s[i] >= 'a' && s[i] <= 'z') || (s[i] >= '0' && s[i] <= '9')) &&
             i < s.length() - 1)
        ++i;
      if (i != j && s[i] == '.') {
        j = ++i;
        int b = 0;
        while (s[i] >= 'a' && s[i] <= 'z') ++b, ++i;
        ans += a * b;
      }
      i = j - 1;
      a = 0;
    }
  cout << ans << endl;
  return 0;
}
