#include <bits/stdc++.h>
using namespace std;
const long long N = 2e6;
struct vrtx {
  map<char, long long> go;
  long long am;
  vrtx() {
    am = 0;
    go.clear();
  }
};
long long sz = 1;
vrtx Bohr[N];
long long get(string s) {
  long long now = 0, ans = s.length();
  bool was = 0;
  for (long long i = 0; i < s.length();) {
    if (Bohr[now].go.count(s[i]) == 0) {
      Bohr[now].go[s[i]] = sz++;
    }
    now = Bohr[now].go[s[i]];
    long long sz = i;
    Bohr[now].am++;
    i++;
    if (Bohr[now].am == 2) {
      while (Bohr[now].am == 2 && Bohr[now].go.count(s[i])) {
        now = Bohr[now].go[s[i]];
        Bohr[now].am++;
        i++;
      }
      if (Bohr[now].go.size() == 0) {
        ans = s.length() - i + sz + 2;
        if (s.length() == i) {
          now = 0;
          for (long long i = 0; i < s.length(); i++) {
            now = Bohr[now].go[s[i]];
            Bohr[now].am--;
          }
        }
      }
    }
  }
  return min(ans, (long long)s.length());
}
inline void solve() {
  string s;
  long long ans = 0;
  while (cin >> s) {
    string now;
    for (long long i = 0; i < s.length(); i++) {
      if ((s[i] >= 'a' && s[i] <= 'z') || (s[i] >= 'A' && s[i] <= 'Z')) {
        now.push_back(s[i]);
      } else {
        ans += get(now);
        now.clear();
        ans++;
      }
    }
    ans += get(now);
    ans++;
  }
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
