#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;
}
static char buf[100 << 20];
void* operator new(size_t s) {
  static size_t i = sizeof buf;
  assert(s < i);
  return (void*)&buf[i -= s];
}
void operator delete(void*) {}
template <class T>
struct ptr {
  unsigned ind;
  ptr(T* p = 0) : ind(p ? unsigned((char*)p - buf) : 0) {
    assert(ind < sizeof buf);
  }
  T& operator*() const { return *(T*)(buf + ind); }
  T* operator->() const { return &**this; }
  T& operator[](int a) const { return (&**this)[a]; }
  explicit operator bool() const { return ind; }
};
struct node {
  node* to[26];
  node* p;
  int cnt;
  bool is_word;
  node() {
    fill_n(to, 26, nullptr);
    p = nullptr;
    cnt = 0;
    is_word = false;
  }
  void add_leaf(int c) {
    to[c] = new node();
    to[c]->p = this;
  }
  void mark(bool word) {
    ++cnt;
    if (word) is_word = true;
    if (p) p->mark(false);
  }
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int ans = 0;
  string line;
  node* root = new node();
  node* u = root;
  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 (!u->to[c]) u->add_leaf(c);
        u = u->to[c];
        ++w;
        if (first_unique == -1 && u->cnt == 1) {
          first_unique = w;
        }
        if (first_unique != -1 && u->is_word) {
          last_term = w;
        }
      } else {
        if (!u->is_word) u->mark(true);
        if (last_term != -1) ans -= max(0, last_term - first_unique - 1);
        u = root;
        w = 0;
        last_term = first_unique = -1;
      }
    }
  }
  cout << ans << '\n';
}
