#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9, maxn = 2e6 + 5;
char s[maxn];
int n;
int cur = 0, bs = 0, state = 1, adr = 0, lst = 0;
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    if (s[i] == '@') {
      int r = 0;
      for (int j = i - 1; j >= 1; j--) {
        if (s[j] == '@' || s[j] == '.') break;
        if (s[j] >= 'a' && s[j] <= 'z') ++r;
      }
      int fg = 0, rr = 0;
      for (int j = i + 1; j <= n; j++) {
        if (s[j] == '.') {
          if (j - i > 1) {
            fg = 1;
            int k;
            for (k = j + 1; k <= n; k++)
              if (s[k] >= 'a' && s[k] <= 'z')
                ++rr;
              else
                break;
            i = k - 1;
          }
          break;
        }
        if (s[j] == '@' || s[j] == '_') {
          i = j - 1;
          break;
        }
      }
      if (fg) ans += 1ll * r * rr;
    }
  }
  printf("%I64d\n", ans);
  return 0;
}
