#include <bits/stdc++.h>
using namespace std;
struct Node {
  map<char, unique_ptr<Node> > next;
  bool terminal;
  Node() { terminal = false; }
  Node *go_next(char to) {
    auto ptr = next.find(to);
    if (ptr == next.end()) {
      Node *nxt = new Node();
      next.insert(make_pair(to, unique_ptr<Node>(nxt)));
      return nxt;
    } else
      return ptr->second.get();
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  unique_ptr<Node> root(new Node());
  Node *ptr = nullptr, *after = nullptr;
  string line;
  int begin, uniq_begin, presses = 0;
  bool space_before;
  while (getline(cin, line)) {
    begin = 0;
    space_before = true;
    presses += line.length();
    for (size_t i = 0; i < line.length(); i++) {
      char ch = line[i];
      if (ch >= 'a' && ch <= 'z') {
        if (space_before) {
          begin = i;
          ptr = root.get();
          uniq_begin = 0;
        }
        after = ptr->go_next(ch);
        if (!after->next.empty()) {
          if (after->terminal || after->next.size() > 1)
            uniq_begin = 0;
          else if (!uniq_begin)
            uniq_begin = i - begin + 1;
        }
        ptr = after;
        if (ptr->terminal && ptr->next.empty()) {
          if (uniq_begin) presses -= i - begin - uniq_begin;
        }
        space_before = false;
      } else {
        if (!space_before) {
          ptr->terminal = true;
        }
        space_before = true;
      }
    }
    if (!space_before) {
      ptr->terminal = true;
    }
    ++presses;
  }
  cout << presses << endl;
  return 0;
}
