#include <bits/stdc++.h>
char s[1000005];
int len;
int match(int a, int b) {
  int i, num = 0;
  for (i = a; i <= b; i++)
    if (s[i] >= 'a' && s[i] <= 'z') num++;
  return num;
}
long long find(int qian, int hou) {
  long long aa = 0, bb = 0;
  int i, pre1, pre2;
  if (hou - qian == 1) return 0;
  for (i = hou + 1; i < len; i++)
    if (s[i] >= 'a' && s[i] <= 'z')
      bb++;
    else {
      break;
    }
  pre2 = qian - 1;
  for (i = qian - 1; i >= 0; i--) {
    if ((s[i] >= '0' && s[i] <= '9') ||
        (s[i] >= 'a' && s[i] <= 'z' || s[i] == '_')) {
      continue;
    } else {
      break;
    }
  }
  pre1 = i + 1;
  aa = match(pre1, pre2);
  return bb * aa;
}
int main() {
  int i, j, qian, hou;
  long long num;
  while (scanf("%s", s) != EOF) {
    num = 0;
    len = strlen(s);
    for (i = 0; i < len; i++) {
      if (s[i] == '@') {
        for (j = i + 1; j < len; j++) {
          if ((s[j] >= '0' && s[j] <= '9') || (s[j] >= 'a' && s[j] <= 'z'))
            continue;
          else if (s[j] == '.') {
            hou = j;
            num += find(i, hou);
            i = hou;
            break;
          } else {
            break;
          }
        }
      }
    }
    printf("%I64d\n", num);
  }
  return 0;
}
