#include <bits/stdc++.h>
struct trie {
  trie* children[26] = {};
  std::string* suggestion = nullptr;
};
trie* root = new trie();
int first_distinct_char_index(int start_idx, const std::string& orig,
                              const std::string& pattern) {
  while (start_idx < orig.length() && start_idx < pattern.length()) {
    if (orig[start_idx] != pattern[start_idx]) {
      return start_idx;
    }
    start_idx += 1;
  }
  return start_idx;
}
int get_required_types(const std::string& str) {
  trie* t = root;
  std::string* copy = nullptr;
  int min = -1;
  for (int i = 0; i < str.length(); ++i) {
    char c = str.at(i);
    int idx = c - 'a';
    if (t->children[idx] == nullptr) {
      t->children[idx] = new trie();
      if (copy == nullptr) {
        copy = new std::string(str);
      }
      t->children[idx]->suggestion = copy;
    } else {
      std::string* suggestion = t->children[idx]->suggestion;
      if (suggestion != nullptr) {
        if (min == -1) {
          int first_distinct = first_distinct_char_index(i, str, *suggestion);
          if (suggestion->length() == first_distinct) {
            min = ((i + 1) + 1) + (str.length() - suggestion->length());
            if (str.length() == first_distinct) {
              break;
            }
          }
          t->children[idx]->suggestion = nullptr;
          int j = i + 1;
          while (j < first_distinct) {
            t = t->children[idx];
            c = str.at(j);
            idx = c - 'a';
            t->children[idx]->suggestion = nullptr;
            j += 1;
          }
          i = j - 1;
        }
      }
    }
    t = t->children[idx];
  }
  if (min == -1) {
    return str.length();
  }
  return std::min(min, (int)str.length());
}
int main() {
  std::string row;
  int cnt = 0;
  while (std::getline(std::cin, row)) {
    if (row.length() == 0) {
      break;
    }
    int start = 0;
    int end = 0;
    while (end < row.length()) {
      char c = row.at(end);
      switch (c) {
        case ' ':
        case '.':
        case ',':
        case '?':
        case '!':
        case '\'':
        case '-':
          if (start != end) {
            std::string s = row.substr(start, end - start);
            cnt += get_required_types(s);
          }
          cnt += 1;
          start = end + 1;
          break;
        default:
          break;
      }
      end += 1;
    }
    if (start != end) {
      std::string s = row.substr(start, end - start + 1);
      cnt += get_required_types(s);
    }
    cnt += 1;
  }
  std::cout << cnt << std::endl;
  return 0;
}
