#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
string s;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> s;
  int le = 0;
  long long ans = 0;
  for (int i = 0; i < s.size();) {
    if (s[i] == '@') {
      int j = i + 1;
      while (j < s.size() && s[j] != '_' && s[j] != '@' && s[j] != '.') ++j;
      if (j == s.size() || s[j] != '.' || j == i + 1)
        i = j;
      else {
        if (s[j] == '.') {
          int prv = i - 1;
          int ok = 0;
          while (prv >= 0 && s[prv] != '@' && s[prv] != '.') {
            if (s[prv] >= 'a' && s[prv] <= 'z') ++ok;
            --prv;
          }
          i = j;
          int nxt = j + 1;
          int ok2 = 0;
          while (nxt < s.size() && s[nxt] >= 'a' && s[nxt] <= 'z') ++nxt, ++ok2;
          ans += 1LL * ok * ok2;
        }
      }
    } else
      ++i;
  }
  cout << ans;
  return 0;
}
