#include <bits/stdc++.h>
unsigned long long c;
int n, i, j, k, ks, ke, pd, pp, pa;
char s[1000100];
bool f, ff, fff;
int main() {
  scanf("%s", s);
  n = strlen(s);
  for (i = 0; i < n; i++) {
    if (s[i] >= 'a' && s[i] <= 'z') {
      k = 0, f = 1, ff = 0, fff = 0, ks = 1, ke = 0, pa = 0, pd = 0, pp = 0;
      for (j = i + 1; f && j < n; j++) {
        if (!k) {
          if (s[j] == '@')
            ++k, pa = j;
          else if (!((s[j] >= 'a' && s[j] <= 'z') ||
                     (s[j] >= '0' && s[j] <= '9') || s[j] == '_'))
            f = 0;
          else if (s[j] >= 'a' && s[j] <= 'z')
            ++ks;
        } else if (k == 1) {
          if (s[j] == '.')
            ++k, pd = j;
          else if ((s[j] >= 'a' && s[j] <= 'z') || (s[j] >= '0' && s[j] <= '9'))
            ff = 1;
          else
            f = 0;
        } else {
          if (s[j] >= 'a' && s[j] <= 'z')
            fff = 1, ++ke, pp = j;
          else
            f = 0;
        }
      }
      if (ff && fff) c += (unsigned long long)ks * ke;
      if (pa)
        i = pa;
      else if (pd)
        i = pd;
      else if (pp)
        i = pp - 1;
      else
        i = j - 1;
    }
  }
  printf("%I64u\n", c);
  return 0;
}
