#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int state = 1;
  int k1, k2, k3;
  k1 = k2 = k3 = 0;
  long long ans = 0;
  s = s + ".";
  for (int i = 0; i < s.length(); i++) {
    if (state == 1) {
      if (isalpha(s[i])) k1++;
      if (s[i] == '@') state = 2;
      if (s[i] == '.') k1 = 0;
    } else if (state == 2) {
      if (isalpha(s[i]) || isdigit(s[i])) {
        if (isalpha(s[i]))
          k2 = 1;
        else
          k2 = 0;
        state = 3;
      } else {
        k1 = 0;
        state = 1;
      }
    } else if (state == 3) {
      if (isalpha(s[i])) k2++;
      if (s[i] == '@') {
        k1 = k2;
        state = 2;
      }
      if (s[i] == '_') {
        k1 = k2;
        state = 1;
      }
      if (s[i] == '.') {
        k3 = 0;
        state = 4;
      }
    } else if (state == 4) {
      if (isalpha(s[i])) k3++;
      if (isdigit(s[i]) || s[i] == '_') {
        ans += (long long)k1 * k3;
        k1 = k3;
        state = 1;
      }
      if (s[i] == '@') {
        ans += (long long)k1 * k3;
        k1 = k3;
        state = 2;
      }
      if (s[i] == '.') {
        ans += (long long)k1 * k3;
        k1 = k2 = k3 = 0;
        state = 1;
      }
    }
  }
  cout << ans;
  return 0;
}
