#include <bits/stdc++.h>
using namespace std;
using LL = long long;
bool check(char c) { return c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z'; }
int main() {
  string s;
  cin >> s;
  int n = s.size();
  LL res = 0ll;
  for (int i = 0; i < n; i++) {
    if (s[i] == '@') {
      LL x = 0ll, y = 0ll;
      for (int j = i - 1; j >= 0; j--) {
        if (s[j] == '@' || s[j] == '.') {
          break;
        }
        if (check(s[j])) x++;
      }
      for (int j = i + 1; j < n; j++) {
        if (s[j] == '@' || s[j] == '_') {
          i = j - 1;
          break;
        }
        if (s[j] == '.') {
          if (j - i == 1) break;
          int k;
          for (k = j + 1; k < n; k++) {
            if (!check(s[k])) break;
            y++;
          }
          i = k - 1;
          break;
        }
      }
      res += x * y;
    }
  }
  cout << res << endl;
}
