#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
const int inf = 2000000000;
int num_nodes = 1;
struct node {
  int sum;
  int next[26];
  bool leaf;
} a[N];
bool contains(string &s) {
  int v = 1;
  for (int i = 0; i < s.length(); i++) {
    int to = a[v].next[s[i] - 'a'];
    if (to == 0) {
      return false;
    }
    v = a[v].next[s[i] - 'a'];
  }
  return a[v].leaf;
}
void add(string &s) {
  if (s.empty() || contains(s)) {
    return;
  }
  int n = s.length();
  int v = 1;
  for (char c : s) {
    a[v].sum += 1;
    if (a[v].next[c - 'a'] == 0) {
      a[v].next[c - 'a'] = ++num_nodes;
    }
    v = a[v].next[c - 'a'];
  }
  a[v].sum += 1;
  a[v].leaf = true;
}
void dfs(int v) {
  for (int c = 0; c < 26; c++) {
    if (a[v].next[c]) {
      cout << v << " " << a[v].next[c] << " " << char(c + 'a') << " "
           << a[v].sum << "\n";
      dfs(a[v].next[c]);
    }
  }
}
int get(int v, string &t, int p) {
  int n = t.length();
  int cnt = 0;
  for (int i = p; i < t.length(); i++) {
    char c = t[i];
    if (a[v].next[c - 'a'] == 0) {
      return a[v].leaf ? cnt : 0;
    }
    v = a[v].next[c - 'a'];
    ++cnt;
  }
  return a[v].leaf ? cnt : 0;
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int ans = 0;
  string s;
  while (getline(cin, s)) {
    s += ' ';
    string t;
    for (char c : s) {
      if (!isalpha(c)) {
        int v = 1, p = -1;
        for (int i = 0; i < t.length(); i++) {
          char c = t[i];
          v = a[v].next[c - 'a'];
          if (v == 0) {
            break;
          }
          if (a[v].sum == 1) {
            p = i + 1;
            break;
          }
        }
        int price = t.length();
        if (p != -1) {
          price -= max(0, get(v, t, p) - 1);
        }
        add(t);
        t = "";
        ans += price;
        ++ans;
      } else {
        t += c;
      }
    }
  }
  cout << ans;
}
