#include <bits/stdc++.h>
using namespace std;
template <typename T>
void alert(const T& t) {
  cout << t << endl;
  exit(0);
}
const long long SIZE = 26;
struct Node {
  Node() {
    for (int i = 0; i < SIZE; ++i) {
      next[i] = -1;
    }
  }
  long long next[SIZE];
  long long count = 0;
  bool leaf = false;
};
vector<Node> bor;
void SetLeaf(int cur) {
  bool f = true;
  for (int i = 0; i < SIZE; ++i) {
    f &= bor[cur].next[i] == -1;
  }
  bor[cur].leaf = f;
}
set<string> se;
long long Add(const string& word) {
  long long cur = 0;
  long long RAZVILKA = 0;
  long long SEKONOMIT = 0;
  vector<int> usedNodes;
  bool izveni = true;
  for (int i = 0; i < word.size(); ++i) {
    char ch = word[i];
    int id = ch - 'a';
    int next = bor[cur].next[id];
    if (next == -1) {
      next = bor.size();
      bor.push_back(Node());
      bor[cur].next[id] = next;
    }
    cur = next;
    bor[cur].count++;
    if (bor[cur].count > 2) {
      RAZVILKA = i + 1;
    }
    if (bor[cur].leaf) {
      SEKONOMIT = i - RAZVILKA - 1;
    }
    usedNodes.push_back(cur);
    bor[cur].leaf = false;
  }
  SetLeaf(cur);
  if (se.count(word)) {
    for (auto& it : usedNodes) {
      bor[it].count--;
    }
  }
  se.insert(word);
  long long ans = word.size();
  if (SEKONOMIT > 0) {
    ans -= SEKONOMIT;
  }
  return ans;
}
void Init() { bor.push_back(Node()); }
void Add(long long& ans, string& s) {
  ans += Add(s);
  s.clear();
}
int main() {
  {}
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  Init();
  string s;
  string kek;
  long long ans = 0;
  while (getline(cin, s)) {
    for (int i = 0; i < s.size(); ++i) {
      char ch = s[i];
      if (isalpha(ch)) {
        kek.push_back(ch);
      } else {
        ans++;
        Add(ans, kek);
      }
    }
    Add(ans, kek);
    ans++;
  }
  cout << ans << endl;
  return 0;
}
