#include <bits/stdc++.h>
using namespace std;
char s[1111111];
int l = 1;
long long dp[1111111][6], ans = 0;
int main(void) {
  scanf("%s", s + 1);
  dp[0][0] = 1;
  for (int i = 1; s[i]; i++, l++) {
    dp[i][0] = dp[i - 1][0];
    if (s[i] >= 'a' && s[i] <= 'z')
      dp[i][1] = dp[i - 1][0] + dp[i - 1][1],
      dp[i][3] = dp[i - 1][2] + dp[i - 1][3],
      dp[i][5] = dp[i - 1][4] + dp[i - 1][5];
    else if (s[i] >= '0' && s[i] <= '9')
      dp[i][1] = dp[i - 1][1], dp[i][3] = dp[i - 1][2] + dp[i - 1][3];
    else if (s[i] == '_')
      dp[i][1] = dp[i - 1][1];
    else if (s[i] == '@')
      dp[i][2] = dp[i - 1][1];
    else if (s[i] == '.')
      dp[i][4] = dp[i - 1][3];
    ans += dp[i][5];
  }
  printf("%lld\n", ans);
  return 0;
}
