#include <bits/stdc++.h>
using namespace std;
map<string, int> version;
int sz = 1;
int szee[300002];
bool terminal[300002];
int parent[300002];
int trie[300002][26];
int prw(string& w) {
  int ans = 0;
  int cur = 0;
  int pos = 0;
  bool flag = false;
  for (int i = 0; i < w.size(); ++i) {
    int lett = w[i] - 'a';
    if (terminal[cur] && szee[cur] == 1) {
      flag = true;
      break;
    } else if (trie[cur][lett] == 0)
      break;
    else {
      ans++;
      cur = trie[cur][lett];
    }
    if (szee[cur] != 1) pos++;
  }
  if (terminal[cur] && szee[cur] == 1) flag = true;
  pos++;
  cur = 0;
  for (int i = 0; i < w.size(); ++i) {
    int lett = w[i] - 'a';
    if (trie[cur][lett] == 0) {
      trie[cur][lett] = sz++;
      parent[trie[cur][lett]] = cur;
    }
    cur = trie[cur][lett];
  }
  if (!terminal[cur]) {
    terminal[cur] = true;
    while (cur != 0) {
      szee[cur]++;
      cur = parent[cur];
    }
    szee[0]++;
  }
  if (flag) {
    return min(w.size(), pos + 1 + (w.size() - ans));
  } else
    return w.size();
}
int main() {
  char c;
  c = getchar();
  int ans = 0;
  int cnt = 0;
  string s = "";
  while (c != EOF) {
    cnt++;
    if (c <= 'z' && c >= 'a')
      s.push_back(c);
    else {
      if (!s.empty()) ans += prw(s);
      s.clear();
      ans++;
    }
    c = getchar();
  }
  if (!s.empty()) ans += prw(s);
  cout << ans;
}
