#include <bits/stdc++.h>
using namespace std;
long long dp[10];
int main() {
  string str;
  cin >> str;
  int len = str.length();
  long long ans = 0;
  for (int i = 1; i <= len; i++) {
    if (str[i - 1] <= 'z' && str[i - 1] >= 'a') {
      dp[0] += 1;
      dp[2] += dp[1];
      dp[1] = 0;
      dp[4] += dp[3];
      dp[3] = 0;
    } else if (str[i - 1] <= '9' && str[i - 1] >= '0') {
      dp[2] += dp[1];
      dp[1] = 0;
      dp[3] = 0;
      dp[4] = 0;
    } else if (str[i - 1] == '_') {
      dp[1] = 0;
      dp[2] = 0;
      dp[3] = 0;
      dp[4] = 0;
    } else if (str[i - 1] == '@') {
      dp[1] = dp[0];
      dp[0] = 0;
      dp[2] = 0;
      dp[3] = 0;
      dp[4] = 0;
    } else if (str[i - 1] == '.') {
      dp[0] = 0;
      dp[1] = 0;
      dp[3] = dp[2];
      dp[2] = 0;
      dp[4] = 0;
    }
    ans += dp[4];
  }
  cout << ans << endl;
  return 0;
}
