#include <bits/stdc++.h>
using namespace std;
long long dp[1000001][6];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  for (int i = 0; i < (int)(s.size()); i++) {
    dp[i][0] = 1;
  }
  for (int i = 0; i < (int)(s.size()); i++)
    for (int j = 0; j < (int)(6); j++) {
      if (j == 0) {
        if (isalpha(s[i])) dp[i + 1][1] += dp[i][0];
      } else if (j == 1) {
        if (isalnum(s[i]) || s[i] == '_') dp[i + 1][1] += dp[i][1];
        if (s[i] == '@') dp[i + 1][2] += dp[i][1];
      } else if (j == 2) {
        if (isalnum(s[i])) dp[i + 1][3] += dp[i][2];
      } else if (j == 3) {
        if (isalnum(s[i])) dp[i + 1][3] += dp[i][3];
        if (s[i] == '.') dp[i + 1][4] += dp[i][3];
      } else if (j == 4) {
        if (isalpha(s[i])) dp[i + 1][5] += dp[i][4];
      } else if (j == 5) {
        if (isalpha(s[i])) dp[i + 1][5] += dp[i][5];
      }
    }
  long long ans = 0;
  for (int i = 0; i < (int)(s.size() + 1); i++) {
    ans += dp[i][5];
  }
  cout << ans << endl;
  return 0;
}
