#include <bits/stdc++.h>
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
using namespace std;
using llong = unsigned long long;
using ld = long double;
using itn = int;
using ii = pair<int, int>;
using ull = unsigned long long;
using pll = pair<llong, llong>;
using psi = pair<string, int>;
using ll = pair<llong, llong>;
const llong over999 = 1e9;
const ld over999ld = 1e18 + 1;
const llong md = 1e9 + 7;
const ld eps = 1e-9;
const ld Pi = acos(-1);
const llong nich = 0;
const int mnogo = 300;
int g[1000100][30], cnt, ans, calc[1000100];
bool flag;
bool letter(char c) { return (c >= 'a' && c <= 'z'); }
int check(string s) {
  int now = 0, ans = 0;
  for (int i = 0; i < s.length(); i++) {
    if (!g[now][s[i] - 'a']) {
      for (int j = 0; j < 26; j++) {
        if (g[now][j]) {
          return 0;
        }
      }
      return max(ans - 2, 0);
    }
    now = g[now][s[i] - 'a'];
    if (calc[now] == 1) ans++;
  }
  for (int i = 0; i < 26; i++) {
    if (g[now][i]) return 0;
  }
  flag = false;
  return max(ans - 2, 0);
}
int add(string s) {
  if (!s.length()) return 0;
  flag = true;
  int ans = int(s.length()) - check(s);
  int now = 0;
  for (int i = 0; i < s.length(); i++) {
    if (!g[now][s[i] - 'a']) g[now][s[i] - 'a'] = ++cnt;
    now = g[now][s[i] - 'a'];
    calc[now] += flag;
  }
  return ans;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  string s;
  string c = "";
  while (getline(cin, s)) {
    for (int i = 0; i < s.length(); i++) {
      if (letter(s[i])) {
        c += s[i];
      } else {
        ans++;
        int dd = add(c);
        ans += dd;
        c = "";
      }
    }
    if (c.length()) {
      int dd = add(c);
      ans += dd;
    }
    c = "";
    ans++;
  }
  cout << ans;
  return 0;
}
