#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1000000000")
using namespace std;
inline void solve();
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
}
string abc = "abcdefghijklmnopqrstuvwxyz";
string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string digits = "0123456789";
struct node {
  map<char, int> next;
  int cnt;
  bool leaf;
  node() {
    cnt = 0;
    leaf = false;
  }
};
int sz = 1;
node a[int(3e5 + 5)];
int add_word(string &str) {
  int v = 0;
  int p = 0;
  int ans = 0;
  int n = 0;
  bool find_one = false;
  bool is_terminal = false;
  for (int i = 0; i < str.length(); i++) {
    if (a[v].next.count(str[i])) {
      v = a[v].next[str[i]];
      if (!find_one && a[v].cnt == 1) {
        p = i + 1;
        find_one = true;
      }
    } else {
      if (a[v].next.size() > 0) {
        ans = str.size();
      } else {
      }
      a[v].next[str[i]] = sz++;
      n++;
      v = a[v].next[str[i]];
    }
    if (find_one && a[v].leaf) is_terminal = true;
  }
  if (n || !is_terminal) {
    v = 0;
    for (int i = 0; i < str.length(); i++) {
      v = a[v].next[str[i]];
      a[v].cnt++;
    }
  }
  a[v].leaf = true;
  if (ans) return ans;
  if (p == 0 || !is_terminal) return str.length();
  return min(p + 1 + n, (int)str.length());
}
void solve() {
  int ans = 0;
  string s;
  while (getline(cin, s)) {
    s += ' ';
    string str;
    for (int i = 0; i < s.length(); i++) {
      if (!isalpha(s[i])) {
        if (str != "") {
          int x = add_word(str);
          ans += x;
        }
        str = "";
        ans++;
      } else {
        str += s[i];
      }
    }
  }
  cout << ans;
}
