#include <bits/stdc++.h>
using namespace std;
const int N = 1000002;
long long dp[N][6];
char ss[N];
string s;
long long calc(int i, int st) {
  if (i >= s.size()) return (st == 5);
  long long &ret = dp[i][st];
  if (ret != -1) return ret;
  ret = (st == 5);
  if (st == 1) {
    if (s[i] == '@') ret += calc(i + 1, 2);
    if (s[i] != '@' && s[i] != '.') ret += calc(i + 1, 1);
  } else if (st == 2) {
    if ((s[i] >= 'a' && s[i] <= 'z') || (s[i] >= '0' && s[i] <= '9'))
      ret += calc(i + 1, 3);
  } else if (st == 3) {
    if ((s[i] >= 'a' && s[i] <= 'z') || (s[i] >= '0' && s[i] <= '9'))
      ret += calc(i + 1, 3);
    if (s[i] == '.') ret += calc(i + 1, 4);
  } else if (st == 4) {
    if (s[i] >= 'a' && s[i] <= 'z') ret += calc(i + 1, 5);
  } else {
    if (s[i] >= 'a' && s[i] <= 'z') ret += calc(i + 1, 5);
  }
  return ret;
}
int main() {
  scanf("%s", ss);
  memset(dp, -1, sizeof dp);
  s = ss;
  long long ans = 0;
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] >= 'a' && s[i] <= 'z') {
      ans += calc(i + 1, 1);
    }
  }
  cout << ans;
  return 0;
}
