#include <bits/stdc++.h>
using namespace std;
char s[1000006];
int main() {
  while (~scanf("%s", s)) {
    long long l = strlen(s), ans = 0;
    for (long long i = 1; i < l; i++) {
      if (s[i] == '@') {
        for (long long j = i + 1; j < l; j++) {
          if (s[j] == '@' || s[j] == '_') break;
          if (s[j] == '.') {
            if (j == i + 1) break;
            {
              long long a1 = 0, a2 = 0;
              for (long long k = i - 1; k >= 0; k--) {
                if (s[k] == '@' || s[k] == '.') break;
                if (isalpha(s[k])) a1++;
              }
              for (long long k = j + 1; k < l; k++) {
                if (isalpha(s[k]))
                  a2++;
                else
                  break;
              }
              i = j;
              ans += a1 * a2;
              break;
            }
          }
        }
      }
    }
    cout << ans << "\n";
  }
  return 0;
}
