#include <bits/stdc++.h>
using namespace std;
template <class T>
int getbit(T s, int i) {
  return (s >> i) & 1;
}
template <class T>
T onbit(T s, int i) {
  return s | (T(1) << i);
}
template <class T>
T offbit(T s, int i) {
  return s & (~(T(1) << i));
}
template <class T>
int cntbit(T s) {
  return s == 0 ? 0 : cntbit(s >> 1) + (s & 1);
}
int n, m;
string s;
bool is_letter(char ch) { return ch >= 'a' && ch <= 'z'; }
bool is_number(char ch) { return ch >= '0' && ch <= '9'; }
bool is_start(char ch) { return is_letter(ch) || is_number(ch) || ch == '_'; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> s;
  n = (int)(s.length());
  int run = 0, u;
  long long res = 0, A, B;
  while (run < n) {
    if (s[run] == '@') {
      A = 0;
      B = 0;
      u = run - 1;
      while (u >= 0 && is_start(s[u])) {
        if (is_letter(s[u])) A++;
        u--;
      }
      u = run + 1;
      while (u < n) {
        if (s[u] == '.' || (!is_letter(s[u]) && !is_number(s[u]))) break;
        u++;
      }
      if (u < n && s[u] == '.' && u != run + 1) {
        u++;
        while (u < n) {
          if (is_letter(s[u])) {
            B++;
            u++;
          } else
            break;
        }
      }
      res += A * B;
    }
    run++;
  }
  cout << res << endl;
}
