#include <bits/stdc++.h>
using namespace std;
bool DEBUG = false;
set<string> used;
struct node {
  int next[26];
  int sz;
  int lastLetter, lastUsed;
  node() {
    memset(next, 0, sizeof next);
    sz = 0;
    lastLetter = 0;
    lastUsed = 0;
  }
};
const int maxN = 6e5 + 10;
string s;
node bor[maxN];
int sizebor = 1;
void addBor(string s) {
  if (used.count(s)) return;
  used.insert(s);
  int ind = 0;
  ++bor[0].sz;
  for (int i = 0; i < s.size(); ++i) {
    int code = s[i] - 'a';
    if (!bor[ind].next[code]) {
      bor[ind].next[code] = sizebor;
      bor[ind].lastUsed = code;
      ++sizebor;
      ind = bor[ind].next[code];
      ++bor[ind].sz;
    } else {
      ind = bor[ind].next[code];
      ++bor[ind].sz;
    }
  }
  bor[ind].lastLetter = 1;
}
int add(int l, int r) {
  string t = "";
  for (int i = l; i <= r; ++i) {
    t += s[i];
  }
  int res = 0;
  int borIndex = 0;
  int i = 0;
  while (i < t.size()) {
    int code = t[i] - 'a';
    if (borIndex == -1) {
      ++i;
      ++res;
    } else {
      if (bor[borIndex].sz > 1 || borIndex == 0) {
        ++res;
        if (!bor[borIndex].next[code]) {
          borIndex = -1;
        } else {
          borIndex = bor[borIndex].next[code];
        }
        ++i;
      } else {
        string h = "";
        int cur_pos = borIndex;
        while (!bor[cur_pos].lastLetter) {
          h += 'a' + bor[cur_pos].lastUsed;
          cur_pos = bor[cur_pos].next[bor[cur_pos].lastUsed];
        }
        bool ok = (h.size());
        if (ok && (i + h.size() - 1) >= t.size()) {
          ok = false;
        } else {
          for (int j = 0; j < h.size(); ++j) {
            if (!ok) break;
            if (t[i + j] != h[j]) ok = false;
          }
        }
        if (ok) {
          res += 1;
          i += h.size();
        } else {
          ++res;
          ++i;
        }
        borIndex = -1;
      }
    }
  }
  addBor(t);
  return res;
}
int solve() {
  int i = 0;
  int ans = 0;
  while (i < s.size()) {
    if (s[i] >= 'a' && s[i] <= 'z') {
      int j = i;
      while (j < s.size() && s[j] >= 'a' && s[j] <= 'z') {
        ++j;
      }
      --j;
      ans += add(i, j);
      i = j + 1;
    } else {
      ++ans;
      ++i;
    }
  }
  return ans;
}
void solveTask() {
  int ans = 0, lines = 0;
  while (getline(cin, s)) {
    ans += solve();
    ++lines;
  }
  cout << ans + lines << endl;
  cerr << lines << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  if (DEBUG) {
    freopen("input.txt", "r", stdin);
  }
  solveTask();
  return 0;
}
