#include <bits/stdc++.h>
using namespace std;
const int T = 1000005;
struct Trie {
  int nn;
  int trie[T][26];
  int cnt[T];
  bool term[T];
  inline void init() {
    memset(trie, 0, sizeof(trie));
    memset(cnt, 0, sizeof(cnt));
    memset(term, 0, sizeof(term));
    nn = 1;
  }
  inline bool find(string& s, bool mode) {
    int nd = 0;
    for (char c : s) {
      if (!trie[nd][c - 'a']) {
        return false;
      }
      nd = trie[nd][c - 'a'];
    }
    if (mode) {
      bool any_out = false;
      for (int i = 0; i < 26; i++) {
        any_out |= (trie[nd][i] > 0);
      }
      return any_out;
    } else {
      return term[nd];
    }
  }
  inline void add(string& s) {
    cnt[0]++;
    int nd = 0;
    for (char c : s) {
      if (!trie[nd][c - 'a']) {
        trie[nd][c - 'a'] = nn++;
      }
      nd = trie[nd][c - 'a'];
      cnt[nd]++;
    }
    term[nd] = true;
  }
  inline int query(string& s) {
    if (find(s, 1)) {
      return (int)s.size();
    }
    int min_unique = -1;
    int known_prefix = 0;
    int nd = 0;
    bool ok = false;
    for (char c : s) {
      if (!trie[nd][c - 'a']) {
        break;
      }
      known_prefix++;
      nd = trie[nd][c - 'a'];
      if (cnt[nd] == 1 && min_unique == -1) {
        min_unique = known_prefix;
      }
      if (min_unique != -1 && term[nd]) {
        ok = true;
      }
    }
    int len = (int)s.size();
    int ans = len;
    if (ok && ~min_unique) {
      ans = min(ans, len - known_prefix + min_unique + 1);
    }
    return ans;
  }
} trie;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  trie.init();
  string s;
  int ans = 0;
  while (getline(cin, s)) {
    string cword;
    vector<string> words;
    for (char c : s) {
      if ('a' <= c && c <= 'z') {
        cword += c;
      } else {
        ans++;
        if (!cword.empty()) {
          words.push_back(cword);
        }
        cword.clear();
      }
    }
    if (!cword.empty()) {
      words.push_back(cword);
    }
    for (auto word : words) {
      ans += trie.query(word);
      if (!trie.find(word, 0)) {
        trie.add(word);
      }
    }
    ans++;
  }
  cout << ans << "\n";
  return 0;
}
