#include <bits/stdc++.h>
using namespace std;
struct node {
  int cnt;
  bool leaf;
  int nx[26];
  node() {
    leaf = false;
    cnt = 0;
    memset(nx, -1, sizeof nx);
  }
};
string s, d;
node t[300100];
int ans, sz;
vector<string> v;
void add(string s) {
  int cur = 0;
  for (int i = 0; i < s.size(); i++) {
    if (t[cur].nx[s[i] - 'a'] != -1)
      cur = t[cur].nx[s[i] - 'a'];
    else {
      t[cur].nx[s[i] - 'a'] = ++sz;
      cur = sz;
    }
    t[cur].cnt++;
  }
  t[cur].leaf = true;
}
bool check(string s) {
  int cur = 0;
  for (int i = 0; i < s.size(); i++) {
    if (t[cur].nx[s[i] - 'a'] != -1)
      cur = t[cur].nx[s[i] - 'a'];
    else
      return false;
  }
  if (t[cur].leaf) return true;
  return false;
}
int calc(string s) {
  int d = -1, cur = 0, mn = -1;
  for (int i = 0; i < s.size(); i++) {
    if (t[cur].nx[s[i] - 'a'] != -1)
      cur = t[cur].nx[s[i] - 'a'];
    else
      break;
    d = i + 1;
  }
  if (d == -1) return s.size();
  for (int i = 0; i < 26; i++)
    if (t[cur].nx[i] != -1) return s.size();
  cur = 0;
  for (int i = 0; i < s.size(); i++) {
    if (t[cur].nx[s[i] - 'a'] != -1)
      cur = t[cur].nx[s[i] - 'a'];
    else
      break;
    if (t[cur].cnt == 1) {
      mn = i + 1;
      break;
    }
  }
  if (mn == -1) return s.size();
  return min(s.size(), mn + 1 + s.size() - d);
}
int main() {
  while (getline(cin, d)) {
    s += d;
    s += "#";
    ans++;
    for (int i = 0; i < d.size(); i++)
      if (!isalpha(d[i])) ans++;
  }
  for (int i = 0; i < s.size();) {
    if (!isalpha(s[i]))
      i++;
    else {
      int j = i + 1;
      while (true) {
        if (!isalpha(s[j])) break;
        j++;
      }
      j--;
      v.push_back(s.substr(i, j - i + 1));
      i = j + 1;
    }
  }
  for (auto a : v) {
    ans += calc(a);
    if (!check(a)) add(a);
  }
  cout << ans;
  return 0;
}
