#include <bits/stdc++.h>
using namespace std;
ofstream coutf;
ifstream cinf;
const int MOD = 1e9 + 7;
const long long INF = 1e18 + 1;
const int alphSize = 26;
string s;
struct Node {
  int ch;
  char nextChar;
  Node *edge[26];
  Node() {
    ch = 0;
    for (int i = 0; i < 26; ++i) edge[i] = nullptr;
  }
};
int solve() {
  Node root;
  Node *v = &root;
  long long ans = 0;
  while (getline(cin, s)) {
    if (s == "") break;
    for (int i = 0; i < s.length(); i++) {
      if ((s[i] == ' ') || (s[i] == ',') || (s[i] == '.') || (s[i] == '?') ||
          (s[i] == '!') || (s[i] == '\'') || (s[i] == '-')) {
        ans++;
        continue;
      }
      v = &root;
      bool dopoln = 0;
      int startWord = i;
      int ansPreStart = ans;
      for (; i < s.length() && s[i] >= 'a' && s[i] <= 'z'; i++) {
        if (v->edge[s[i] - 'a'] == nullptr) {
          v->edge[s[i] - 'a'] = new Node();
          v->nextChar = s[i];
        } else if ((v->nextChar == s[i]) && (v->ch == 1) && (v != &root)) {
          if (!dopoln) ans++;
          dopoln = 1;
          for (; i < s.length() && v->nextChar == s[i]; i++) {
            v->nextChar = s[i];
            v = v->edge[s[i] - 'a'];
          }
          if ((s[i] >= 'a' && s[i] <= 'z') && v->nextChar == '<') {
            Node *k = &root;
            for (int j = startWord; j < i; j++) {
              k->ch++;
              k = k->edge[s[j] - 'a'];
            }
            k->ch++;
          } else if ((s[i] >= 'a' && s[i] <= 'z') && v->nextChar != '<') {
            Node *k = &root;
            ans = ansPreStart;
            for (int j = startWord; j < i; j++) {
              k->ch++;
              ans++;
              k = k->edge[s[j] - 'a'];
            }
            k->ch++;
          } else if ((v->nextChar != '<') && (v->nextChar != s[i])) {
            Node *k = &root;
            ans = ansPreStart;
            for (int j = startWord; j < i; j++) {
              ans++;
              k->ch++;
              k = k->edge[s[j] - 'a'];
            }
            k->ch++;
          }
          i--;
          continue;
        }
        ans++;
        v->ch++;
        v = v->edge[s[i] - 'a'];
      }
      i--;
      v->ch++;
      v->nextChar = '<';
    }
    ans++;
  }
  cout << ans;
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cinf.open("input.txt");
  coutf.open("output.txt");
  solve();
  cinf.close();
  coutf.close();
  return 0;
}
