#include <bits/stdc++.h>
using namespace std;
bool isLetter(char c) { return c >= 'a' && c <= 'z'; }
struct Node {
  bool term;
  int sz = 0;
  vector<int> e;
  Node() {
    term = 0;
    sz = 0;
    e.resize(26, -1);
  }
};
vector<Node> Bore;
void add(string s) {
  int now = 0;
  for (char i : s) {
    int k = i - 'a';
    Bore[now].sz++;
    if (Bore[now].e[k] != -1) {
      now = Bore[now].e[k];
    } else {
      Bore[now].e[k] = Bore.size();
      now = Bore.size();
      Bore.emplace_back();
    }
  }
  Bore[now].term = 1;
  Bore[now].sz++;
}
bool isLeaf(int v) {
  for (int i = 0; i < 26; ++i) {
    if (Bore[v].e[i] != -1) {
      return false;
    }
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  vector<string> words;
  string s;
  int cnt = 0;
  while (getline(cin, s)) {
    ++cnt;
    string now;
    for (char i : s) {
      if (isLetter(i)) {
        now += i;
      } else {
        ++cnt;
        if (!now.empty()) {
          words.push_back(now);
        }
        now = "";
      }
    }
    if (!now.empty()) {
      words.push_back(now);
    }
  }
  int ans = cnt;
  Bore.emplace_back();
  map<string, bool> was;
  for (const auto &x : words) {
    int now = 0, c = 0;
    bool fl = 0;
    for (char i : x) {
      int k = i - 'a';
      if (Bore[now].sz == 1 && now && !isLeaf(now)) {
        c++;
      }
      if (Bore[now].e[k] != -1) {
        now = Bore[now].e[k];
      } else {
        fl = 1;
        if (isLeaf(now)) {
          fl = 0;
        }
        break;
      }
    }
    int upd;
    if (!fl && isLeaf(now)) {
      upd = min(x.size() - c + 1, x.size());
    } else {
      upd = x.size();
    }
    ans += upd;
    if (!was[x]) {
      add(x);
      was[x] = 1;
    }
  }
  cout << ans << '\n';
}
