#include <bits/stdc++.h>
using namespace std;
const int N = (int)(1e5 + 20);
const long long int INF = (1ll << 62);
string s;
long long int ans = 0;
int find(int pos) {
  for (int i = pos; i < s.length(); ++i)
    if (s[i] == '@') return i;
  return -1;
}
int find_dot(int pos) {
  for (int i = pos; i < s.length(); ++i) {
    if (s[i] == '.') {
      return i;
    }
    if (!isalnum(s[i])) return -1;
  }
  return -1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> s;
  int last = -1;
  while ((last = find(last + 1)) != -1) {
    int dot = find_dot(last + 1);
    if (dot == last + 1 || dot == -1) continue;
    int cnt = 0;
    while (dot + cnt + 1 < s.length() && isalpha(s[dot + cnt + 1])) ++cnt;
    int j = last - 1;
    while (j >= 0) {
      if (isalpha(s[j])) {
        ans += cnt;
        --j;
      } else if (isalnum(s[j]) || s[j] == '_')
        --j;
      else
        break;
    }
  }
  cout << ans;
  return 0;
}
