#include <bits/stdc++.h>
using namespace std;
template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << '{';
  for (int i = (0), __i = (((int)(vec).size())); i < __i; i++) {
    os << vec[i];
    if (i + 1 != ((int)(vec).size())) os << ',';
  }
  os << '}';
  return os;
}
template <class T1, class T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &par) {
  os << '(' << par.first << ',' << par.second << ')';
  return os;
}
int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); }
template <class T>
T sqr(T x) {
  return x * x;
}
const long long MOD = 1e9 + 7;
long long bin_pow(long long base, long long p) {
  if (p == 1) return base;
  if (p % 2 == 0) {
    long long t = bin_pow(base, p / 2);
    return t * t % MOD;
  } else
    return bin_pow(base, p - 1) * base % MOD;
}
long long inverse_element(long long x) { return bin_pow(x, MOD - 2); }
long long add(long long a, long long b) { return (a + b) % MOD; }
long long sub(long long a, long long b) { return (MOD + a - b) % MOD; }
long long divide(long long a, long long b) {
  return a * inverse_element(b) % MOD;
}
long long mult(long long a, long long b) { return (a * b) % MOD; }
struct Node {
  map<char, int> path;
  int par;
  bool end;
};
Node nodes[303030];
int cnt = 1;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  nodes[0].end = true;
  int cur = 0;
  int res = 0;
  while (true) {
    string s;
    getline(cin, s);
    if (cin.eof()) break;
    for (int i = (0), __i = (s.length()); i < __i; i++) {
      res++;
      if (s[i] >= 'a' && s[i] <= 'z') {
        if (nodes[cur].path.find(s[i]) == nodes[cur].path.end()) {
          nodes[cur].path[s[i]] = cnt;
          nodes[cnt].par = cur;
          cur = cnt++;
        } else {
          cur = nodes[cur].path[s[i]];
        }
        if (nodes[cur].end && nodes[cur].path.size() == 0) {
          int c = nodes[cur].par;
          if (nodes[c].path.size() == 1 && !nodes[c].end) {
            while (nodes[c].path.size() == 1 && !nodes[c].end) {
              c = nodes[c].par;
              res--;
            }
            res++;
          }
        }
      } else {
        if (cur != 0) {
          nodes[cur].end = true;
          cur = 0;
        }
      }
    }
    res++;
    if (cur != 0) {
      nodes[cur].end = true;
      cur = 0;
    }
  }
  cout << res;
  return 0;
}
