#include <bits/stdc++.h>
using namespace std;
struct Node {
  bool end;
  Node **next;
  int cnt;
  Node *p;
  Node() {
    end = false;
    cnt = 0;
    p = nullptr;
    next = new Node *[26];
    for (int i = 0; i < 26; ++i) {
      next[i] = nullptr;
    }
  }
};
int ans = 0;
Node *root;
void add(string s) {
  Node *cur = root;
  for (int i = 0; i < s.length(); ++i) {
    ++ans;
    if (cur->next[s[i] - 'a']) {
      cur = cur->next[s[i] - 'a'];
      if (cur->cnt == 1 && !cur->end) {
        int j = i + 1;
        Node *q = cur;
        bool f = false;
        while (j < s.length() && q->next[s[j] - 'a']) {
          q = q->next[s[j++] - 'a'];
          f = true;
        }
        if (q->end && f) {
          ++ans;
        } else {
          ans += j - i - 1;
        }
        i = j - 1;
        cur = q;
      }
    } else {
      Node *nw = new Node();
      nw->p = cur;
      cur->next[s[i] - 'a'] = nw;
      cur = nw;
    }
  }
  if (!cur->end) {
    cur->end = true;
    while (cur != root) {
      cur = cur->p;
      ++cur->cnt;
    }
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  char c;
  string s = "";
  root = new Node();
  while ((c = getchar()) != EOF) {
    if (c <= 'z' && c >= 'a') {
      s += c;
    } else {
      if (s != "") {
        int old = ans;
        add(s);
      }
      s = "";
      ++ans;
    }
  }
  if (s != "") {
    add(s);
  }
  cout << ans;
  return 0;
}
