#include <bits/stdc++.h>
using namespace std;
const int N = 1000005;
char str[N];
long long dp[N][5];
long long calc(int i, int s) {
  if (str[i] == 0) return 0;
  long long &ret = dp[i][s];
  if (ret != -1) return ret;
  ret = 0;
  if (s == 0) {
    ret += calc(i + 1, 0);
    if (isalpha(str[i])) ret += calc(i + 1, 1);
  } else if (s == 1) {
    if (isalnum(str[i]) || str[i] == '_')
      ret += calc(i + 1, 1);
    else if (str[i] == '@')
      ret += calc(i + 1, 2);
  } else if (s == 2) {
    if (isalnum(str[i])) ret += calc(i + 1, 3);
  } else if (s == 3) {
    if (isalnum(str[i]))
      ret += calc(i + 1, 3);
    else if (str[i] == '.')
      ret += calc(i + 1, 4);
  } else {
    if (isalpha(str[i])) ret += 1 + calc(i + 1, 4);
  }
  return ret;
}
int main() {
  scanf("%s", str);
  memset(dp, -1, sizeof dp);
  cout << calc(0, 0);
  return 0;
}
