#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
ostream& operator<<(ostream& s, pair<A, B> p) {
  cerr << "(" << p.first << ", " << p.second << ")";
  return s;
}
template <typename T>
ostream& operator<<(ostream& s, vector<T> v) {
  for (int i = 0; i <= (int)v.size() - 1; i++) {
    cerr << v[i] << " ";
  }
  return s;
}
template <typename T>
ostream& operator<<(ostream& s, set<T> t) {
  cerr << "{";
  for (auto z : t) {
    cerr << z << " ";
  }
  cerr << "}";
  return s;
}
const int MAX = 300005;
const int CNTL = 26;
struct TrieNode {
  int nxt[CNTL];
  int cntWords;
  bool isTerminal;
  TrieNode() {
    cntWords = 0;
    isTerminal = false;
    for (int i = 0; i <= CNTL - 1; i++) {
      nxt[i] = -1;
    }
  }
};
struct Trie {
  TrieNode nodes[MAX];
  int q;
  Trie() {
    q = 1;
    nodes[0].cntWords = 1;
    nodes[0].isTerminal = true;
  }
  void add(const string& s) {
    int curPos = 0;
    for (int i = 0; i <= (int)s.size() - 1; i++) {
      nodes[curPos].cntWords++;
      if (nodes[curPos].nxt[s[i] - 'a'] == -1) {
        nodes[curPos].nxt[s[i] - 'a'] = q;
        q++;
      }
      curPos = nodes[curPos].nxt[s[i] - 'a'];
    }
    nodes[curPos].cntWords++;
    nodes[curPos].isTerminal = true;
  }
  int get(const string& s) {
    int curPos = 0;
    int ps = 0;
    int res = -1;
    for (int i = 0; i <= (int)s.size() - 1; i++) {
      if (res < 0 && nodes[curPos].cntWords == 1) {
        res = i;
      }
      if (nodes[curPos].nxt[s[i] - 'a'] == -1) {
        if (nodes[curPos].isTerminal) {
          return res;
        }
        return -1;
      }
      curPos = nodes[curPos].nxt[s[i] - 'a'];
    }
    if (nodes[curPos].isTerminal) {
      return res;
    } else {
      return -1;
    }
  }
  int getLen(const string& s) {
    int curPos = 0;
    int ps = 0;
    for (int i = 0; i <= (int)s.size() - 1; i++) {
      if (nodes[curPos].nxt[s[i] - 'a'] == -1) {
        return i;
      }
      curPos = nodes[curPos].nxt[s[i] - 'a'];
    }
    return (int)s.size();
  }
  bool check(const string& s) {
    int curPos = 0;
    int ps = 0;
    for (int i = 0; i <= (int)s.size() - 1; i++) {
      if (nodes[curPos].nxt[s[i] - 'a'] == -1) {
        return false;
      }
      curPos = nodes[curPos].nxt[s[i] - 'a'];
    }
    return nodes[curPos].isTerminal;
  }
} trie;
bool isLetter(int c) {
  return (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'));
}
int ans;
void processWord(const string& s) {
  int res = 0;
  while (0) {
  };
  int curRes = trie.get(s);
  while (0) {
  };
  if (curRes == -1) {
    res = (int)s.size();
  } else {
    int lenExist = trie.getLen(s);
    res = min(curRes + 1 + (int)s.size() - lenExist, (int)s.size());
  }
  while (0) {
  };
  ans += res;
  if (!trie.check(s)) {
    trie.add(s);
  }
}
void solve() {
  string curWord;
  int tmp;
  while ((tmp = getchar()) != EOF) {
    if (tmp == '\r') {
      continue;
    }
    if (isLetter(tmp)) {
      curWord.push_back(tmp);
    } else {
      if ((int)curWord.size()) {
        processWord(curWord);
        curWord.clear();
      }
      ans++;
    }
  }
  if ((int)curWord.size()) {
    processWord(curWord);
  }
  printf("%d\n", ans);
}
int main() {
  solve();
  return 0;
}
