#include <bits/stdc++.h>
using namespace std;
struct Node {
  vector<Node*> kids;
  int sz;
  bool flag;
  int dist;
  Node() : flag(false), sz(0) { kids.resize(26, nullptr); }
};
typedef Node* PNode;
PNode root = new Node();
void add(PNode& root, const string& s, int pos) {
  if (pos == s.size()) {
    if (root->flag == false) {
      root->flag = true;
      root->sz++;
      if (root->sz == 1) {
        root->dist = 0;
      }
    }
    return;
  }
  int kid = s[pos] - 'a';
  if (!root->kids[kid]) {
    root->kids[kid] = new Node();
  }
  root->sz -= root->kids[kid]->sz;
  add(root->kids[kid], s, pos + 1);
  root->sz += root->kids[kid]->sz;
  if (root->sz == 1) {
    root->dist = root->kids[kid]->dist + 1;
  }
}
inline bool isletter(char c) {
  if (c >= 'a' && c <= 'z') {
    return true;
  }
  return false;
}
int get_next(const string& s, int it) {
  int n = s.size();
  while (it < n && isletter(s[it])) {
    it++;
  }
  return it;
}
void add_word(const string& s, int l, int r) {
  add(root, s.substr(l, r - l), 0);
}
bool go(PNode cur, const string& s, int l, int r) {
  int it = l;
  while (it < r) {
    if (cur->kids[s[it] - 'a'] == nullptr) {
      return false;
    }
    cur = cur->kids[s[it] - 'a'];
    it++;
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  string s;
  int ans = 0;
  while (getline(cin, s)) {
    int it = 0;
    int n = s.size();
    if (s == "lightning then the thunder") {
      n += 0;
    }
    while (it < n) {
      if (!isletter(s[it])) {
        ans++;
        it++;
        continue;
      }
      int nxt = get_next(s, it);
      PNode cur = root;
      bool checked = false;
      for (int i = it; i < nxt; ++i) {
        if (cur->kids[s[i] - 'a'] == nullptr) {
          ans += (nxt - i);
          break;
        }
        cur = cur->kids[s[i] - 'a'];
        ans++;
        if (cur->sz == 1 && i != nxt - 1 && (nxt - i) > cur->dist &&
            cur->dist > 0) {
          if (!checked && go(cur, s, i + 1, i + cur->dist + 1)) {
            ans++;
            ans += (nxt - (i + cur->dist + 1));
            break;
          } else {
            checked = true;
          }
        }
      }
      add_word(s, it, nxt);
      it = nxt;
    }
    ans++;
  }
  cout << ans << endl;
}
