#include <bits/stdc++.h>
using namespace std;
const int INF = 1E9;
int getchar(char c) { return c - 'a'; }
struct bor {
  bor* to[26];
  int color;
  bor() {
    for (int i = 0; i < 26; ++i) {
      to[i] = NULL;
    }
    color = 0;
  }
};
int getcount(const string& s, bor* b, int ind, int ed, bool f) {
  if (b->color == 2) {
    f = true;
  }
  if (ind == s.length()) {
    if ((b->color == 1) || (b->color == 3) || (ed == 0) || (!f)) {
      return s.length();
    } else {
      return int(s.length()) + 1 - ed;
    }
  }
  if (b->to[getchar(s[ind])] == NULL) {
    b->to[getchar(s[ind])] = new bor();
  }
  int ted = 0;
  if (b->color == 1) {
    ted = 1;
  }
  return getcount(s, b->to[getchar(s[ind])], ind + 1, ed + ted, f);
}
bool add(const string& s, bor* b, int ind) {
  if (ind == s.length()) {
    if (b->color == 0) {
      b->color = 2;
      return false;
    } else if ((b->color == 1) || (b->color == 3)) {
      b->color = 3;
      return false;
    } else {
      return true;
    }
  }
  bool f = add(s, b->to[getchar(s[ind])], ind + 1);
  if (f) {
    return true;
  }
  if (b->color == 0) {
    b->color = 1;
  } else {
    b->color = 3;
  }
  return false;
}
bor* b = new bor();
const string punc = " .,?!'-";
int main() {
  ios_base::sync_with_stdio(0);
  b->color = 3;
  string s, t;
  t = "";
  int ans = 0;
  while (getline(cin, s)) {
    ++ans;
    for (size_t i = 0; i < s.length(); ++i) {
      if (punc.find(s[i]) != string::npos) {
        ++ans;
        continue;
      }
      t.push_back(s[i]);
      if ((i + 1 == s.length()) || (punc.find(s[i + 1]) != string::npos)) {
        ans += getcount(t, b, 0, 0, false);
        add(t, b, 0);
        t = "";
      }
    }
  }
  cout << ans << '\n';
}
