#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  string s;
  while (cin >> s) {
    long long l = 0, m = 0, r = 0, t = 0;
    long long ans = 0;
    char c = 0;
    for (int i = 0; i < s.length(); i++) {
      if (c == 0) {
        if (isalpha(s[i]))
          l++;
        else if (s[i] == '_' || isdigit(s[i])) {
        } else if (l && s[i] == '@') {
          c = '@';
          m = 0;
          t = 0;
        } else if (s[i] == '.')
          l = 0;
      } else if (c == '@') {
        if (isalpha(s[i])) t++;
        if (isalpha(s[i]) || isdigit(s[i]))
          m++;
        else if (m && s[i] == '.') {
          r = 0;
          c = '.';
        } else if (s[i] == '_') {
          l = t;
          c = 0;
        } else if (t && s[i] == '@') {
          l = t;
          m = 0;
          t = 0;
          c = '@';
        } else {
          c = 0;
          l = 0;
        }
      } else if (c == '.') {
        if (isalpha(s[i]))
          r++;
        else {
          ans += l * r;
          c = 0;
          if ((s[i] == '_' || isdigit(s[i])))
            l = r;
          else if (r && s[i] == '@') {
            c = '@';
            l = r;
            m = 0;
            t = 0;
          } else
            l = 0;
        }
      }
    }
    if (c == '.') ans += l * r;
    cout << ans << endl;
  }
  return 0;
}
