#include <bits/stdc++.h>
using namespace std;
int n;
unsigned long long dp[1000000][6];
string s;
unsigned long long f(int i, int t) {
  if (i == n)
    return 0;
  else if (dp[i][t] != -1)
    return dp[i][t];
  unsigned long long res = 0;
  if (t == 0 && s[i] >= 'a' && s[i] <= 'z')
    res += f(i + 1, 1) + f(i + 1, 2);
  else if (t == 1 && (s[i] >= 'a' && s[i] <= 'z' ||
                      s[i] >= '0' && s[i] <= '9' || s[i] == '_'))
    res += f(i + 1, 1) + f(i + 1, 2);
  else if (t == 2 && s[i] == '@')
    res += f(i + 1, 3);
  else if (t == 3 && (s[i] >= 'a' && s[i] <= 'z' || s[i] >= '0' && s[i] <= '9'))
    res += f(i + 1, 3) + f(i + 1, 4);
  else if (t == 4 && s[i] == '.')
    res += f(i + 1, 5);
  else if (t == 5 && s[i] >= 'a' && s[i] <= 'z')
    res += 1 + f(i + 1, 5);
  return dp[i][t] = res;
}
int main() {
  cin.sync_with_stdio(false);
  cin >> s;
  n = s.size();
  memset(dp, -1, sizeof(dp));
  unsigned long long res = 0;
  for (int i = 0; i < n; ++i) res += f(i, 0);
  cout << res << "\n";
  return 0;
}
