#include <bits/stdc++.h>
using namespace std;
long long n, m, tot;
long long x = 0;
string s;
int main() {
  cin >> s;
  long long punct = 0, lng = 0, arond = 0, nxt = 0, lngpunct = 0;
  long long tip1 = 0, tip2 = 0, tip3 = 0;
  for (int i = s.size() - 1; i >= 0; i--) {
    if (s[i] == '.') {
      punct = i;
      lngpunct = tip3;
      arond = 0;
    } else if (s[i] == '@') {
      if (punct - i - 1 == tip2 && tip2) {
        arond = i;
        nxt = punct;
      }
    }
    if (isalpha(s[i]) && nxt && arond - i - 1 == tip1) tot += lngpunct;
    if (isalnum(s[i]) || s[i] == '_') {
      tip1++;
    } else {
      tip1 = 0;
    }
    if (isalnum(s[i])) {
      tip2++;
    } else {
      tip2 = 0;
    }
    if (isalpha(s[i])) {
      tip3++;
    } else {
      tip3 = 0;
    }
  }
  cout << tot;
  return 0;
}
