#include <bits/stdc++.h>
using namespace std;
struct node {
  map<char, int> nxt;
  bool isEnd;
};
node tree[300013];
int root = 0;
int nodeCnt = 2;
inline bool isLetter(char c) {
  if (c >= 'a' && c <= 'z') {
    return true;
  } else {
    return false;
  }
}
int main() {
  tree[root].nxt['1'] = 1;
  tree[root].isEnd = false;
  string s;
  int tapCnt = 0;
  while (getline(cin, s)) {
    int numNode = 0, lineLen = 0;
    for (unsigned int i = 0; i < s.length(); ++i) {
      ++tapCnt;
      if (isLetter(s[i])) {
        if (tree[numNode].nxt.count(s[i])) {
          if (!tree[numNode].isEnd && tree[numNode].nxt.size() == 1) {
            ++lineLen;
          } else {
            lineLen = 0;
          }
          numNode = tree[numNode].nxt[s[i]];
          if (!tree[numNode].nxt.size() && lineLen > 0) {
            tapCnt -= lineLen - 1;
          }
        } else {
          tree[numNode].nxt[s[i]] = nodeCnt++;
          numNode = nodeCnt - 1;
          tree[numNode].isEnd = false;
        }
      } else {
        tree[numNode].isEnd = true;
        numNode = 0;
        lineLen = 0;
      }
    }
    tree[numNode].isEnd = true;
    ++tapCnt;
  }
  cout << tapCnt;
  return 0;
}
