#include <bits/stdc++.h>
using namespace std;
struct node {
  bool term;
  map<char, node*> edg;
  node() : term(false) {}
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  node* root = new node;
  node* place = root;
  string s;
  int ans = 0;
  int lastmoreone = 0;
  bool f;
  int glub = 0;
  while (getline(cin, s)) {
    f = true;
    for (int i = 0; i < s.size(); i++) {
      if (!(s[i] >= 'a' && s[i] <= 'z')) {
        place = root;
        glub = 0;
        ans++;
        f = true;
        lastmoreone = 0;
      } else if (f) {
        if (place->edg.find(s[i]) == place->edg.end()) {
          f = false;
          ans++;
          place->edg[s[i]] = new node;
          place = place->edg[s[i]];
          if ((i + 1 == s.size()) ||
              (i + 1 < s.size() && !(s[i + 1] >= 'a' && s[i + 1] <= 'z'))) {
            place->term = true;
          }
        } else {
          if (place->edg.size() > 1 || place->term) {
            lastmoreone = glub;
          }
          place = place->edg[s[i]];
          glub++;
          ans++;
          if (place->term && place->edg.size() == 0) {
            ans -= max(glub - lastmoreone - 2, 0);
            f = false;
          }
          if ((i + 1 == s.size()) ||
              (i + 1 < s.size() && !(s[i + 1] >= 'a' && s[i + 1] <= 'z'))) {
            place->term = true;
          }
        }
      } else {
        ans++;
        place->edg[s[i]] = new node;
        place = place->edg[s[i]];
        if ((i + 1 == s.size()) ||
            (i + 1 < s.size() && !(s[i + 1] >= 'a' && s[i + 1] <= 'z'))) {
          place->term = true;
        }
      }
    }
    place = root;
    glub = 0;
    f = true;
    ans++;
    lastmoreone = 0;
  }
  cout << ans;
}
