#include <bits/stdc++.h>
using namespace std;
template <class T>
bool uin(T& a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool uax(T& a, T b) {
  return a < b ? (a = b, true) : false;
}
const int nax = 3e5 + 10;
bool is_word[nax];
int go[nax][26];
int p[nax], cnt[nax];
void mark(int u, bool result) {
  ++cnt[u];
  if (result) is_word[u] = true;
  if (p[u]) mark(p[u], false);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string line;
  int ans = 0, cc = 0, u = 0;
  while (getline(cin, line)) {
    line += '\n';
    ans += (int)line.size();
    int first_unique = -1, last_term = -1, w = 0;
    for (char ch : line) {
      if (islower(ch)) {
        int c = (int)ch - 'a';
        if (!go[u][c]) {
          go[u][c] = ++cc;
          p[cc] = u;
        }
        u = go[u][c];
        ++w;
        if (first_unique == -1 && cnt[u] == 1) {
          first_unique = w;
        }
        if (first_unique != -1 && is_word[u]) {
          last_term = w;
        }
      } else {
        if (!is_word[u]) mark(u, true);
        if (last_term != -1) ans -= max(0, last_term - first_unique - 1);
        u = w = 0;
        first_unique = last_term = -1;
      }
    }
  }
  cout << ans << '\n';
}
