#include <bits/stdc++.h>
using namespace std;
struct Tmas {
  int go[27];
  int p;
  int kil;
  bool leaf;
};
Tmas tree[310000];
int where;
void start() {
  where = 1;
  for (int i = 0; i < 27; ++i) tree[0].go[i] = -1;
  tree[0].p = -1;
  tree[0].kil = 0;
}
int add(string &s) {
  int v = 0, c;
  int ans = 0;
  bool out = false, hehe = false;
  for (int i = 0; i < s.length(); ++i) {
    c = s[i] - 'a';
    if (tree[v].go[c] == -1) {
      hehe = true;
      if (tree[v].leaf && tree[v].kil == 1)
        ans += s.length() - i;
      else
        ans = s.length();
      break;
    }
    if (tree[tree[v].go[c]].kil == 1) {
      if (!out) {
        ans += 2;
        out = true;
      }
    } else if (!out)
      ++ans;
    v = tree[v].go[c];
  }
  if (out && !hehe) {
    if (!(tree[v].leaf)) ans = s.length();
  }
  int n = s.length();
  ans = min(ans, n);
  v = 0;
  for (int i = 0; i < s.length(); ++i) {
    c = s[i] - 'a';
    if (tree[v].go[c] == -1) {
      for (int i = 0; i < 27; ++i) tree[where].go[i] = -1;
      tree[v].go[c] = where;
      tree[where].p = v;
      ++where;
    }
    v = tree[v].go[c];
  }
  int lol = v;
  if (!tree[v].leaf || tree[v].kil == 0) {
    while (v != -1) {
      ++tree[v].kil;
      v = tree[v].p;
    }
  }
  tree[lol].leaf = true;
  return ans;
}
vector<string> words;
bool symbol(char c) {
  if (c < 'a' || c > 'z') return true;
  return false;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  char c;
  string word = "";
  int counter = 0;
  while (cin.read(&c, 1)) {
    if (symbol(c)) {
      ++counter;
      if (word != "") words.push_back(word);
      word = "";
    } else
      word += c;
  }
  if (word != "") words.push_back(word);
  start();
  int res = 0;
  for (int i = 0; i < words.size(); ++i) res += add(words[i]);
  cout << res + counter;
}
