#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const long long max3 = 1003;
const long long max4 = 10004;
const long long maxx = 300005;
const long long max6 = 1000006;
const long long max7 = 10000007;
const long long lg4 = 13;
const long long lg5 = 17;
const long long lg6 = 20;
const long long INF = 2LL * 1000000000;
const long long INFLL = 9LL * 1000000000 * 1000000000;
long long powmod(long long a, long long b, long long mod) {
  long long res = 1;
  a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) res = (res * a) % mod;
    a = (a * a) % mod;
  }
  return res;
}
long long gcd(long long a, long long b) {
  while (b > 0) {
    long long t = a % b;
    a = b, b = t;
  }
  return a;
}
long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
long long is_prime(long long n) {
  if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0)) return 0;
  for (long long i = 5, t = 2; i * i <= n; i += t, t = 6 - t)
    if (n % i == 0) return 0;
  return 1;
}
string s;
int trie[maxx << 1][26], nxt = 1;
int occur[maxx], par[maxx], is[maxx];
char added[maxx];
int res = 0;
int update(int i) {
  int v = 0, ok = 0;
  int x = 0;
  for (; isalpha(s[i]); i++) {
    int idx = s[i] - 'a';
    if (ok == 0) {
      res++, occur[v]++;
      if (trie[v][idx] > 0) {
        v = trie[v][idx];
      } else {
        added[v] = s[i], par[nxt] = v;
        trie[v][idx] = nxt;
        v = nxt++;
      }
      if (occur[v] == 1) {
        ok = 1;
      }
    } else {
      if (s[i] != added[v]) {
        if (!added[v]) {
          res += min(x, 1);
        } else {
          res += x;
        }
        ok = 0, i--;
      } else {
        occur[v]++, x++;
        v = trie[v][added[v] - 'a'];
      }
    }
  }
  occur[v]++;
  if (ok == 1) {
    if (!added[v]) {
      res += min(x, 1);
    } else {
      res += x;
    }
  }
  if (is[v] == 1) {
    occur[v]--;
    while (v != 0) {
      v = par[v], occur[v]--;
    }
  } else {
    is[v] = 1;
  }
  return i;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  ;
  getline(cin, s);
  while (s.size() > 0) {
    for (int i = 0; i < s.size(); i++) {
      if (!isalpha(s[i])) {
        res++;
        continue;
      }
      i = update(i) - 1;
    }
    res++;
    getline(cin, s);
  }
  cout << res << '\n';
  return 0;
}
