#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
const int inf = (int)1e9 + 5;
const long long INF = (long long)1e18 + 5;
const long long maxn = 'z' - 'a' + 1;
struct node {
  bool is_word = false;
  long long count = 0;
  vector<long long> transitions;
  node() { transitions.assign(maxn, -1); }
};
long long ans = 0;
vector<node> t(1);
void add_string(string &s) {
  long long v = 0, cur_ans = 0, last_one = -1;
  for (auto &h : s) {
    long long c = h - 'a';
    if (t[v].transitions[c] == -1) {
      t[v].transitions[c] = t.size();
      t.push_back(node());
    }
    v = t[v].transitions[c];
    if (t[v].count != 1)
      cur_ans++;
    else
      last_one = v;
  }
  cur_ans += 2;
  if (last_one != -1 && !t[last_one].is_word) cur_ans = INF;
  if (!t[v].is_word) {
    v = 0;
    for (auto &h : s) {
      v = t[v].transitions[h - 'a'];
      t[v].count++;
    }
    t[v].is_word = true;
  }
  cur_ans = min(cur_ans, (long long)s.length());
  ans += cur_ans;
}
void solve() {
  string s, t;
  while (getline(cin, s)) {
    s += " ";
    t = "";
    for (auto c : s) {
      if ('a' <= c && c <= 'z')
        t += c;
      else {
        ans++;
        add_string(t);
        t = "";
      }
    }
  }
  cout << ans;
}
int main() {
  string filename = "acm";
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.precision(15);
  solve();
  (void)0;
  return 0;
}
