#include <bits/stdc++.h>
using namespace std;
char ch[1052001];
int main() {
  scanf("%s", ch);
  int len = strlen(ch);
  long long cnt = 0, a = 0, ans = 0;
  for (int i = 0; i < len; i++) {
    if ((ch[i] >= 'a' && ch[i] <= 'z'))
      cnt++;
    else if (ch[i] == '.')
      cnt = 0;
    else if (ch[i] == '@') {
      int j = ++i;
      while (i < len &&
             ((ch[i] >= 'a' && ch[i] <= 'z') || (ch[i] >= '0' && ch[i] <= '9')))
        ++i;
      if (i != j && ch[i] == '.') {
        j = ++i;
        a = 0;
        while (i < len && (ch[i] >= 'a' && ch[i] <= 'z')) {
          i++;
          a++;
        }
        ans += a * cnt;
      }
      i = j - 1;
      cnt = 0;
    }
  }
  printf("%I64d\n", ans);
  return 0;
}
