#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:251700000")
using namespace std;
const long long LINF = 9e18;
const int INF = 2e9;
const int M = 4e5 + 6;
int g[27][M], d[M], sz, x, y;
string s;
bool term[M];
void add() {
  int v = 0, f = 0;
  x = y = -1;
  for (int i = 0; i < s.size(); ++i) {
    int c = s[i] - 'a';
    if (!g[c][v]) g[c][v] = ++sz, f = 1;
    v = g[c][v];
    if (d[v] == 1 && x == -1) x = i;
    if (term[v]) y = i;
  }
  if (f || !term[v]) {
    v = 0;
    for (int i = 0; i < s.size(); ++i) {
      int c = s[i] - 'a';
      v = g[c][v];
      ++d[v];
    }
  }
  term[v] = 1;
  if (y == -1) x = -1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string t;
  int i, ans = 0;
  while (getline(cin, t)) {
    i = 0;
    while (i < t.size()) {
      if (!('a' <= t[i] && t[i] <= 'z')) {
        ++ans;
        ++i;
        continue;
      }
      s = "";
      while (i < t.size() && 'a' <= t[i] && t[i] <= 'z') s += t[i], ++i;
      add();
      if (x != -1)
        ans += min(s.size(), x + 1 + s.size() - y);
      else
        ans += s.size();
    }
    ++ans;
  }
  cout << ans;
}
