#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
enum { MOD0 = 1000000000, MOD7 = 1000000007, MOD9 = 1000000009 };
template <typename T>
ostream &operator<<(ostream &cout, vector<T> &a) {
  for (size_t i = 0; i < a.size(); ++i) cout << a[i] << " ";
  return cout;
}
template <typename T>
ostream &operator<<(ostream &cout, vector<vector<T> > &a) {
  for (size_t i = 0; i < a.size(); ++i) cout << a[i] << endl;
  return cout;
}
struct TrieNode {
  char c = 0;
  bool end = 0;
  int rank = 0;
  int prev;
  int next[26] = {};
} trie[300100];
int new_TrieNode() {
  static int c = 0;
  return ++c;
}
int next(int cur, int c) {
  if (trie[cur].next[c - 'a']) return trie[cur].next[c - 'a'];
  int new_tn = new_TrieNode();
  trie[cur].next[c - 'a'] = new_tn;
  trie[new_tn].prev = cur;
  return trie[cur].next[c - 'a'];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int c;
  int cur = 0;
  int ans = 0;
  int sv = 0;
  while ((c = getchar()) != EOF) {
    ++ans;
    if (!isalpha(c)) {
      if (cur) {
        if (trie[cur].end == 0) {
          trie[cur].end = 1;
        } else {
          while (cur) {
            trie[cur].rank--;
            cur = trie[cur].prev;
          }
        }
      }
      cur = 0;
      sv = 0;
      continue;
    }
    cur = next(cur, c);
    trie[cur].rank++;
    if (trie[cur].rank == 2) {
      ++sv;
    }
    if (trie[cur].end) {
      ans -= max(sv - 2, 0);
      sv = 0;
    }
  }
  printf("%d\n", ans);
  return 0;
}
