#include <bits/stdc++.h>
using std::string;
struct node {
  int counter;
  std::map<char, size_t> to;
  node() : counter(0) {}
};
std::vector<node> tree;
int ans = 0;
std::set<string> printed_strings;
void add(const string& string_to_add) {
  if (printed_strings.count(string_to_add)) {
    return;
  }
  printed_strings.insert(string_to_add);
  size_t current_letter = 0;
  ++tree[current_letter].counter;
  for (int i = 0; i < string_to_add.size(); ++i) {
    if (!tree[current_letter].to.count(string_to_add[i])) {
      tree.push_back(node());
      tree[current_letter].to[string_to_add[i]] = tree.size() - 1;
    }
    size_t next = tree[current_letter].to[string_to_add[i]];
    current_letter = next;
    ++tree[next].counter;
  }
}
void solve(const string& string_to_print) {
  if (tree[0].counter == 0) {
    ans += string_to_print.size();
    return;
  }
  size_t current_letter = 0;
  size_t i = 0;
  while (i < string_to_print.size() && tree[current_letter].counter > 1) {
    if (!tree[current_letter].to.count(string_to_print[i])) {
      ans += string_to_print.size();
      return;
    }
    current_letter = tree[current_letter].to[string_to_print[i]];
    ++i;
  }
  if (i == string_to_print.size()) {
    ans += string_to_print.size();
    return;
  }
  if (current_letter == 0) {
    auto it = tree[current_letter].to.begin();
    if (it->first != string_to_print[i]) {
      ans += string_to_print.size();
      return;
    }
    current_letter = it->second;
    ++i;
  }
  int eco = 0;
  while (!tree[current_letter].to.empty()) {
    if (i == string_to_print.size()) {
      ans += string_to_print.size();
      return;
    }
    auto it = tree[current_letter].to.begin();
    if (it->first != string_to_print[i]) {
      ans += string_to_print.size();
      return;
    }
    ++eco;
    current_letter = it->second;
    ++i;
  }
  ans += std::min(string_to_print.size(), string_to_print.size() - eco + 1);
}
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);
  tree.push_back(node());
  std::string s;
  while (getline(std::cin, s)) {
    ++ans;
    for (int i = 0; i < s.size(); ++i) {
      if (!isalpha(s[i])) {
        ++ans;
      }
    }
    std::vector<string> words(10);
    string curr = "";
    for (int i = 0; i < s.size(); ++i) {
      if (isalpha(s[i])) {
        curr += s[i];
      } else if (curr != "") {
        words.push_back(curr);
        curr = "";
      }
    }
    if (curr != "") {
      words.push_back(curr);
    }
    for (int i = 0; i < words.size(); ++i) {
      solve(words[i]);
      add(words[i]);
    }
  }
  std::cout << ans << "\n";
}
