#include <bits/stdc++.h>
using namespace std;
const long long INF = 2e18;
const long long N = 3e5 + 1;
const long long mod = 1e9 + 7;
const long double eps = 1E-7;
int now;
string s, p;
vector<int> V1, V2;
map<string, char> mp;
int g, v, f, h, l, ans;
int a[N][26], b[N][26];
void check() {
  if (p.empty()) return;
  v = 0;
  l = -1;
  V1.clear();
  V2.clear();
  now = p.size();
  for (int i = 0; i < p.size(); i++) {
    f = p[i] - 'a';
    if (b[v][f] == 1 && l == -1) l = i;
    if (!a[v][f]) {
      h = 0;
      for (int j = 0; j < 26; j++)
        if (a[v][j]) h = 1;
      if (l != -1 && !h) {
        now -= max(0, i - l - 2);
        ans -= max(0, i - l - 2);
      }
      a[v][f] = ++g;
      l = -1;
    }
    b[v][f]++;
    V1.push_back(v);
    V2.push_back(f);
    v = a[v][f];
    if (i == p.size() - 1) {
      h = 0;
      for (int j = 0; j < 26; j++)
        if (a[v][j]) h = 1;
      if (!h && l != -1) now -= max(0, i - l - 1), ans -= max(0, i - l - 1);
      if (mp[p] == 1)
        for (int j = 0; j < V1.size(); j++) b[V1[j]][V2[j]]--;
    }
  }
  mp[p] = 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  while (getline(cin, s)) {
    ans++;
    p.clear();
    ans += s.size();
    for (auto k : s) {
      if (k >= 97 && k <= 122)
        p += k;
      else {
        check();
        p.clear();
      }
    }
    check();
  }
  cout << ans << endl;
}
