#include <bits/stdc++.h>
using namespace std;
string s;
vector<int> v;
int main() {
  while (cin >> s) {
    long long ans = 0;
    for (int i = 0; i < s.size(); i++) {
      if (s[i] == '@') {
        int j;
        long long ct = 0;
        for (j = i - 1; j >= 0; j--) {
          if (s[j] >= 'a' && s[j] <= 'z')
            ct++;
          else if (s[j] == '.' || s[j] == '@')
            break;
        }
        long long cnt = 0;
        j = i + 1;
        for (; j < s.size() && s[j] != '.' && s[j] != '_' && s[j] != '@';) j++;
        if (j == i + 1) continue;
        if (s[j] == '@' || s[j] == '_') continue;
        for (j = j + 1; j < s.size(); j++) {
          if (s[j] >= 'a' && s[j] <= 'z')
            cnt++;
          else
            break;
        }
        ans += cnt * ct;
      }
    }
    printf("%I64d\n", ans);
  }
  return 0;
}
