#include <bits/stdc++.h>
using namespace std;
char string_in_buffer[(int)2e7];
void fast_scan(int &first) { scanf("%d", &first); }
void fast_scan(long long &first) { scanf("%lld", &first); }
void fast_scan(unsigned long long &first) { scanf("%llu", &first); }
void fast_scan(double &first) { scanf("%lf", &first); }
void fast_scan(long double &first) { scanf("%Lf", &first); }
void fast_scan(char &first) {
  scanf("%c", &first);
  if (first == '\n') {
    fast_scan(first);
  }
}
void fast_scan(string &first) {
  scanf("%s", string_in_buffer);
  first = string(string_in_buffer);
}
template <class TFirst, class TSecond>
void fast_scan(pair<TFirst, TSecond> &p) {
  fast_scan(p.first);
  fast_scan(p.second);
}
template <class T>
void fast_scan(vector<T> &v) {
  for (auto &first : v) fast_scan(first);
}
void fast_print(const int &first) { printf("%d", first); }
void fast_print(const long long &first) { printf("%lld", first); }
void fast_print(const unsigned long long &first) { printf("%llu", first); }
void fast_print(const double &first) { printf("%.15lf", first); }
void fast_print(const long double &first) { printf("%.15Lf", first); }
void fast_print(const char &first) { printf("%c", first); };
void fast_print(const string &first) { printf("%s", first.c_str()); }
template <class TFirst, class TSecond>
void fast_print(const pair<TFirst, TSecond> &p) {
  fast_print(p.first);
  fast_print(' ');
  fast_print(p.second);
}
template <class T>
void fast_print(const vector<T> &v) {
  if (v.empty()) return;
  fast_print(v[0]);
  for (int i = 1; i < v.size(); i++) {
    fast_print(" ");
    fast_print(v[i]);
  }
}
template <class T>
void fast_print(const vector<vector<T>> &v) {
  if (v.empty()) return;
  fast_print(v[0]);
  for (int i = 1; i < v.size(); i++) {
    fast_print("\n");
    fast_print(v[i]);
  }
}
using namespace std;
namespace smart_io {
string print_start = "";
string sep = " ";
bool first_print = false;
void precall_print() {
  fast_print(print_start);
  print_start = "\n";
  first_print = true;
}
void _print(deque<string>) {}
template <class T, class... Args>
void _print(deque<string> names, T kek, Args... args) {
  if (!first_print) {
    fast_print("\n");
  } else {
    first_print = false;
  }
  fast_print(names.front());
  fast_print(" = ");
  fast_print(kek);
  names.pop_front();
  _print(names, args...);
}
}  // namespace smart_io
template <class T>
ostream &operator,(ostream &os, const T &object) {
  if (!smart_io::first_print) {
    fast_print(smart_io::sep);
  } else {
    smart_io::first_print = false;
  }
  fast_print(object);
  return os;
}
template <class T>
istream &operator,(istream &is, T &object) {
  fast_scan(object);
  return is;
}
namespace typedefs {}
namespace numbers_operation {
template <class T>
T floor_mod(T a, T b) {
  if (a % b == 0) return 0;
  if (a >= 0 && b >= 0) return a % b;
  if (a <= 0 && b <= 0) return a % b;
  return abs(b) - (abs(a) % abs(b));
}
}  // namespace numbers_operation
using namespace numbers_operation;
using namespace typedefs;
struct Node {
  map<char, Node *> childs;
  int ends = 0;
  bool term = false;
  int depth = 0;
  Node(int _depth) { depth = _depth; }
  bool has(const string &s, int i) {
    if (i >= ((int)s.size())) {
      return term;
    }
    if (!childs.count(s[i])) {
      return false;
    }
    return childs[s[i]]->has(s, i + 1);
  }
  void add(const string &s, int i) {
    ends++;
    if (i >= ((int)s.size())) {
      term = true;
      return;
    }
    if (!childs.count(s[i])) {
      childs[s[i]] = new Node(depth + 1);
    }
    childs[s[i]]->add(s, i + 1);
  }
};
Node *root = new Node(0);
int process(string s) {
  if (((int)s.size()) <= 2) {
    if (!root->has(s, 0)) {
      root->add(s, 0);
    }
    return ((int)s.size());
  }
  int kek = -1;
  Node *cur = root;
  for (int i = 0; i < ((int)s.size()); i++) {
    char c = s[i];
    if (!cur->childs.count(c)) {
      break;
    } else {
      if (i > 0 && kek == -1 && cur->ends == 1) {
        kek = i + 1;
      }
    }
    cur = cur->childs[c];
  }
  if (kek != -1 && cur->term) {
    if (!root->has(s, 0)) {
      root->add(s, 0);
    }
    return min(((int)s.size()), kek + ((int)s.size()) - cur->depth);
  }
  kek = -1;
  if (!root->has(s, 0)) {
    root->add(s, 0);
  }
  if (kek == -1) {
    return ((int)s.size());
  } else {
    return min(max(kek, 2), ((int)s.size()));
  }
}
signed main(signed argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string text = "";
  string s;
  while (getline(cin, s)) {
    text += s + "\n";
  }
  string buf = "";
  int rez = 0;
  for (char c : text) {
    if ('a' <= c && c <= 'z') {
      buf += c;
    } else {
      int d = process(buf);
      if (d != ((int)buf.size())) {
      } else {
      }
      rez += d;
      buf.clear();
      rez++;
    }
  }
  smart_io::precall_print();
  cout, rez;
}
