#include <bits/stdc++.h>
using namespace std;
const int MAXIMUS = 300007;
int idx = 1;
int trie[MAXIMUS][26];
int cnt[MAXIMUS];
bool isEnd[MAXIMUS];
int ans;
int moveTrie(int x, char c) {
  if (trie[x][c - 'a'] == 0) trie[x][c - 'a'] = idx++;
  return trie[x][c - 'a'];
}
bool isLetter(char c) { return (('a' <= c) && (c <= 'z')); }
bool goodPrefix(const string& s, int x, int pos) {
  while (isLetter(s[pos])) {
    if (isEnd[x]) return true;
    if (trie[x][s[pos] - 'a'] == 0) return false;
    x = moveTrie(x, s[pos]);
    ++pos;
  }
  return isEnd[x];
}
void solve(const string& s) {
  int x = 0;
  int st = 0;
  for (int i = 0; i < s.length(); ++i) {
    if (!isLetter(s[i])) {
      if (isEnd[x]) {
        int y = 0;
        for (int j = st; j < i; ++j) {
          y = moveTrie(y, s[j]);
          --cnt[y];
        }
      }
      if (x != 0) isEnd[x] = true;
      x = 0;
      st = i + 1;
      ++ans;
    } else {
      if (cnt[x] == 2) {
        if (isEnd[x]) {
          x = moveTrie(x, s[i]);
          ++cnt[x];
          ++ans;
        } else {
          if (goodPrefix(s, x, i)) {
            while (isLetter(s[i]) && (trie[x][s[i] - 'a'] != 0)) {
              x = moveTrie(x, s[i]);
              ++cnt[x];
              ++i;
            }
            ++ans;
            while (isLetter(s[i])) {
              x = moveTrie(x, s[i]);
              ++cnt[x];
              ++i;
              ++ans;
            }
            --i;
          } else {
            while (isLetter(s[i])) {
              x = moveTrie(x, s[i]);
              ++cnt[x];
              ++i;
              ++ans;
            }
            --i;
          }
        }
      } else {
        x = moveTrie(x, s[i]);
        ++cnt[x];
        ++ans;
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  string s;
  while (getline(cin, s)) {
    s.push_back('\n');
    solve(s);
  }
  cout << ans;
  return 0;
}
