#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  long long res = 0;
  int res1 = 0, res2 = 0, res3 = 0;
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] == '@') {
      for (int j = i - 1; j >= 0; --j) {
        if (s[j] == '.' || s[j] == '@') break;
        if ((s[j] >= '0' && s[j] <= '9') || s[j] == '_') continue;
        res1++;
      }
      bool f = 0;
      int pos = 0;
      for (int j = i + 1; j < s.size(); ++j) {
        if ((s[j] >= '0' && s[j] <= '9') || (s[j] >= 'a' && s[j] <= 'z')) {
          res2++;
          continue;
        }
        if (s[j] == '.') {
          f = 1;
          pos = j;
          break;
        } else
          break;
      }
      if (!f || res2 < 1) {
        res1 = 0;
        res2 = 0;
        res3 = 0;
        continue;
      } else {
        for (int j = pos + 1; j < s.size(); ++j) {
          if (s[j] >= 'a' && s[j] <= 'z')
            res3++;
          else
            break;
        }
      }
      res += res1 * 1LL * res3;
      res1 = res2 = res3 = 0;
    }
  }
  printf("%I64d\n", res);
  return 0;
}
