#include <bits/stdc++.h>
using namespace std;
struct Trie {
  Trie *next[26];
  int cnt;
  bool end;
  Trie() {
    for (int i = 0; i < 26; i++) next[i] = NULL;
    cnt = 0, end = false;
  }
} * root;
void add(string &s, Trie *root) {
  Trie *cur = root;
  cur->cnt++;
  for (char c : s) {
    int id = c - 'a';
    if (cur->next[id] == NULL) cur->next[id] = new Trie();
    cur = cur->next[id];
    cur->cnt++;
  }
  cur->end = true;
}
int get(string &s, Trie *root) {
  int res = 0, cnt = 0;
  bool end = false;
  Trie *cur = root;
  for (char c : s) {
    int id = c - 'a';
    if (cur->next[id] == NULL) cur->next[id] = new Trie();
    cur = cur->next[id];
    res++;
    if (cur->cnt == 1) {
      cnt++;
      if (cur->end) end = true;
    }
  }
  if (!cur->end) add(s, root);
  if (end) res -= max(0, cnt - 2);
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string s, tmp;
  while (getline(cin, tmp)) s += tmp + "\n";
  root = new Trie();
  string t = "";
  int ans = 0;
  for (char c : s) {
    if (c >= 'a' && c <= 'z')
      t += c;
    else {
      ans++;
      if (!t.empty()) ans += get(t, root);
      t = "";
    }
  }
  if (!t.empty()) ans += get(t, root);
  cout << ans;
  return 0;
}
