#include <bits/stdc++.h>
using namespace std;
string s;
long long numbers, lastdog, curgood, tomult, dotplace, dogp = 0;
int main() {
  cin >> s;
  vector<long long> dogs;
  numbers = 0;
  for (long long i = 0; i < s.size(); i++)
    if (s[i] == '@') dogs.push_back(i);
  lastdog = 0;
  while (dogp < dogs.size()) {
    curgood = 0;
    for (long long i = dogs[dogp] - 1; i >= 0; i--) {
      if (isalpha(s[i]))
        ++curgood;
      else if (!(isdigit(s[i]) || s[i] == '_'))
        break;
    }
    tomult = 0;
    dotplace = 0;
    for (long long i = dogs[dogp] + 1; i < s.size(); i++) {
      if (dotplace == 0) {
        if (s[i] == '_' || s[i] == '@') {
          tomult = 0;
          break;
        }
        if (s[i] == '.') {
          if (i == dogs[dogp] + 1) {
            tomult = 0;
            break;
          } else {
            dotplace = i;
          }
        }
      } else {
        if (isalpha(s[i]))
          tomult++;
        else
          break;
      }
    }
    lastdog = dogs[dogp++];
    numbers += curgood * tomult;
  }
  cout << numbers << endl;
}
