#include <bits/stdc++.h>
using namespace std;
char ch, ss[300010];
int cnt, c[300010][26], sum[300010], cct, Rt = 0, si[300010], sst, fa[300010];
inline int calc() {
  int nw, nl, ret = cct;
  for (nw = 0, nl = 1; nl <= cct; nl++) {
    if (si[nw] && sum[nw] == 1) {
      int ts = 0, tx = nw;
      while (sum[tx] == 1) tx = fa[tx], ts++;
      ret -= max(0, (ts - 2));
    }
    if (!c[nw][ss[nl] - 'a']) c[nw][ss[nl] - 'a'] = ++sst, fa[sst] = nw;
    nw = c[nw][ss[nl] - 'a'];
  }
  if (!si[nw]) {
    si[nw] = 1;
    while (nw) sum[nw]++, nw = fa[nw];
    return ret;
  }
  int ts = 0;
  while (sum[nw] == 1) nw = fa[nw], ts++;
  return ret - max(ts - 2, 0);
}
int main() {
  while (scanf("%c", &ch) != EOF) {
    if (ch < 'a' || ch > 'z') {
      cnt++;
      continue;
    }
    cct = 0;
    while (1) {
      ss[++cct] = ch;
      scanf("%c", &ch);
      if (ch < 'a' || ch > 'z') {
        cnt++;
        break;
      }
    }
    cnt += calc();
  }
  cout << cnt << endl;
  return 0;
}
