#include <bits/stdc++.h>
using namespace std;
int const N = 1000100;
char s[N];
int main() {
  scanf(" %s", s);
  int n = strlen(s);
  long long ret = 0;
  for (int i = 0; i < (n); ++i)
    if (s[i] == '@') {
      long long a = 0, b = 0;
      for (int j = i - 1; j >= 0; --j) {
        if (s[j] == '.' || s[j] == '@') break;
        if (s[j] >= 'a' && s[j] <= 'z') ++a;
      }
      int cc = 0, q = 0;
      for (int j = i + 1; j < n; ++j) {
        if (s[j] == '@' || s[j] == '_') break;
        if (s[j] == '.') {
          if (cc == 1) break;
          if (q == 0) break;
          ++cc;
        } else {
          if (cc == 0) {
            ++q;
          } else {
            if (s[j] >= '0' && s[j] <= '9')
              break;
            else
              ++b;
          }
        }
      }
      ret += a * b;
    }
  printf("%I64d\n", ret);
  return 0;
}
