#include <bits/stdc++.h>
using namespace std;
const long long N = 3e5 + 5, INF = 1e9;
string s2, s;
struct data {
  int next[30];
  int cnt;
  bool least;
};
data t[N];
int sz = 1, ans;
string p;
inline void add(string s) {
  int v = 0;
  t[v].cnt++;
  for (int i = 0; i < s.size(); ++i) {
    int x = s[i] - 'a';
    if (t[v].next[x] == -1) {
      t[v].next[x] = sz;
      sz++;
    }
    v = t[v].next[x];
    t[v].cnt++;
  }
  t[v].least = true;
}
map<string, bool> usd;
bool flag;
inline void f(int &pos) {
  int v = 0;
  int c = -1;
  int k = 0;
  if (t[v].next[s[pos] - 'a'] == -1) {
    pos--;
    return;
  }
  while (s[pos] >= 'a' && s[pos] <= 'z') {
    int x = s[pos] - 'a';
    if (t[v].next[x] == -1) break;
    k++;
    if (k >= 2 && t[v].cnt == 1) c++;
    p += s[pos];
    v = t[v].next[x];
    pos++;
  }
  pos--;
  ans += k;
  if (c != -1 && t[v].least == 1) ans -= c;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  for (int i = 0; i <= 300000; ++i) {
    for (int j = 0; j <= 26; ++j) {
      t[i].next[j] = -1;
    }
    t[i].cnt = 0;
    t[i].least = false;
  }
  while (getline(cin, s2)) {
    s += s2;
    s += ' ';
  }
  for (int i = 0; i < s.size(); ++i) {
    if (!flag && s[i] >= 'a' && s[i] <= 'z')
      flag = true, f(i);
    else {
      ans++;
      if (s[i] >= 'a' && s[i] <= 'z')
        p += s[i];
      else if (p != "") {
        if (!usd[p]) add(p), usd[p] = true;
        p = "";
      }
      if (s[i] < 'a' || s[i] > 'z') flag = false;
    }
  }
  cout << ans;
}
