#include <bits/stdc++.h>
const int SIZE = 1000100;
char s[SIZE];
int l;
int main() {
  gets(s + 1);
  l = strlen(s + 1);
  long long sum = 0;
  for (int i = 1; i <= l; i++) {
    if (s[i] != '@') continue;
    int left = 0;
    for (int pos = i - 1; pos > 0 && s[pos] != '@' && s[pos] != '.'; pos--) {
      if (s[pos] >= 'a' && s[pos] <= 'z') left++;
    }
    int pos;
    for (pos = i + 1;
         pos <= l && s[pos] != '.' && s[pos] != '@' && s[pos] != '_'; pos++)
      ;
    if (pos == i + 1) continue;
    if (s[pos] == '_' || s[pos] == '@') continue;
    int right = 0;
    for (pos++; pos <= l && s[pos] >= 'a' && s[pos] <= 'z'; pos++) right++;
    sum += 1ll * left * right;
  }
  printf("%I64d\n", sum);
  return 0;
}
