#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
template <class T, class R>
ostream& operator<<(ostream& os, pair<T, R>& v) {
  os << '(' << v.first << ' ' << v.second << ')' << ' ';
  return os;
}
template <class T>
ostream& operator<<(ostream& os, vector<T>& v) {
  for (auto i : v) os << i << " ";
  return os;
}
template <class T>
ostream& operator<<(ostream& os, set<T>& v) {
  for (auto i : v) os << i << " ";
  return os;
}
unordered_map<string, string*> some;
struct Node {
  Node* parent;
  vector<Node*> children;
  int wordsCount;
  string* word;
  Node(Node* parent = nullptr) : parent(parent), wordsCount(0), word(nullptr) {
    children.resize(26, nullptr);
  }
  Node* getChild(char c) {
    if (children[c - 'a'] == nullptr) {
      children[c - 'a'] = new Node(this);
    }
    return children[c - 'a'];
  }
};
struct Bor {
  unordered_set<string> words;
  Node* root;
  Bor() : root(new Node()) {}
  int addWord(string& s) {
    bool was = (words.find(s) != words.end());
    Node* now = root;
    int ans = 0;
    int step = 1;
    int stepForStep = 1e9;
    int len = 0;
    bool gg = false;
    for (char& x : s) {
      len++;
      now = now->getChild(x);
      stepForStep--;
      if (stepForStep == 0) step = 1;
      ans += step;
      if (!gg && now->wordsCount == 1) {
        if (was && len != s.size()) {
          ans++;
          step = 0;
          stepForStep = 1e9;
        } else if (now->word != nullptr && now->word->size() != len &&
                   *now->word == s.substr(0, now->word->size())) {
          ans++;
          step = 0;
          stepForStep = now->word->size() - len + 1;
        }
        gg = true;
      }
    }
    if (step != 0) {
      if (now->word == nullptr) now->word = new string(s);
      auto kek = now->word;
      while (now != root) {
        now->wordsCount += 1;
        if (now->wordsCount == 1) now->word = kek;
        now = now->parent;
      }
      if (now->wordsCount == 1) now->word = kek;
      now->wordsCount += 1;
    }
    words.insert(s);
    return ans;
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  string s;
  int ans = 0;
  int count = 0;
  Bor bor;
  int gl = 0;
  int vsego = 0;
  while (getline(cin, s)) {
    vsego += s.size() + 1;
    ans += 1;
    string now;
    for (char x : s) {
      if (x >= 'a' && x <= 'z' || x >= 'A' && x <= 'Z') {
        now += x;
      } else {
        ans++;
        if (now != "") {
          int cnt = bor.addWord(now);
          ans += cnt;
          gl += cnt;
          now = "";
        }
      }
    }
    if (now != "") {
      int cnt = bor.addWord(now);
      ans += cnt;
      gl += cnt;
    }
  }
  cout << ans;
}
