#include <bits/stdc++.h>
using namespace std;
int main() {
  string cad;
  while (cin >> cad) {
    int size = cad.size();
    long long suma = 0;
    long long A = 0;
    long long D = 0;
    long long B = 0;
    long long C = 0;
    int dot = 0;
    bool first = true;
    for (int i = 0; i < size; i++) {
      char c = cad[i];
      if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {
        A++;
        D++;
        if (!first && dot == 1) B++;
      } else if (c == '.') {
        if (D)
          dot++;
        else
          dot += 2;
        A = 0;
      } else if (c >= '0' && c <= '9') {
        D++;
        if (dot == 1) dot++;
      } else if (c == '_')
        dot += 2;
      else if (c == '@') {
        if (first) {
          first = false;
        } else {
          suma += (C * B);
        }
        C = A;
        A = 0;
        B = 0;
        D = 0;
        dot = 0;
      } else {
        A = 0;
        dot += 2;
      }
    }
    suma += (C * B);
    cout << suma << endl;
  }
  return 0;
}
