#include <bits/stdc++.h>
using namespace std;
const int E = 26;
struct Node {
  int next[E];
  bool isEnd;
  int cnt;
  Node() {
    memset(next, -1, sizeof(next));
    isEnd = false;
    cnt = 0;
  }
};
vector<Node> trie(1);
void incPath(const string &s) {
  int v = 0;
  int n = s.length();
  for (int i = 0; i < n; i++) {
    v = trie[v].next[s[i] - 'a'];
    trie[v].cnt++;
  }
}
void add(const string &s) {
  int v = 0;
  int n = s.length();
  for (int i = 0; i < n; i++) {
    if (trie[v].next[s[i] - 'a'] == -1) {
      trie[v].next[s[i] - 'a'] = trie.size();
      trie.push_back(Node());
    }
    v = trie[v].next[s[i] - 'a'];
  }
  if (!trie[v].isEnd) {
    trie[v].isEnd = true;
    incPath(s);
  }
}
int print(const string &s) {
  int v = 0;
  int n = s.length();
  int autoStart = -1;
  int autoEnd = -1;
  for (int i = 0; i < n; i++) {
    if (trie[v].cnt == 1 && autoStart == -1) {
      autoStart = i;
    }
    if (trie[v].next[s[i] - 'a'] == -1) {
      trie[v].next[s[i] - 'a'] = trie.size();
      trie.push_back(Node());
      if (autoEnd == -1) {
        if (!trie[v].isEnd) {
          return n;
        }
        autoEnd = i;
      }
    }
    v = trie[v].next[s[i] - 'a'];
  }
  if (trie[v].isEnd) {
    autoEnd = n;
  }
  if (autoEnd == -1 || autoStart == -1) {
    return n;
  }
  return autoStart + 1 + (n - autoEnd);
}
int main() {
  int ans = 0, delta = 0;
  char c;
  string s;
  while (true) {
    s = "";
    while ((c = getchar()) != -1 &&
           (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'))) {
      if ('A' <= c && c <= 'Z') {
        c = c - 'A' + 'a';
      }
      s += c;
    }
    if (s.size() != 0) {
      delta += s.size() - min(print(s), (int)s.size());
      ans += s.size();
      add(s);
    }
    if (c == -1) {
      break;
    }
    ans++;
  }
  cout << ans - delta;
  return 0;
}
