#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
const int INF = (int)(1e9 + 1e6);
const long long LINF = (long long)(4e18);
const double EPS = 1e-9;
mt19937 ggen;
const long long MOD = (long long)(1e9 + 7);
int t;
void solve();
void init();
int num_clicks(string& s);
const int k = 26;
struct vertex {
  int next[k];
  int ver_num;
  int cou;
  bool flag;
};
vector<vertex> trie;
vertex make_ver();
int add_str(const string& s);
int add_new_str(const string& s);
bool is_str_in_trie(const string& s);
int n;
string txt;
int ans = 0;
int main() {
  iostream::sync_with_stdio(false);
  cin.tie(0);
  ggen = mt19937(1337);
  t = 1;
  for (int i = 0; i < t; ++i) {
    solve();
  }
  return 0;
}
void solve() {
  init();
  for (int i = 0; i < n; ++i) {
    if (txt[i] >= 'a' && txt[i] <= 'z') {
      string s;
      int j;
      for (j = i; j < n && txt[j] >= 'a' && txt[j] <= 'z'; ++j) {
        s += txt[j];
      }
      i = j - 1;
      ans += num_clicks(s);
    } else {
      ans++;
    }
  }
  cout << ans;
}
void init() {
  while (true) {
    string s;
    getline(cin, s);
    if (s == "") break;
    txt += s;
    txt += ' ';
  }
  n = (int)(txt).size();
  trie.push_back(make_ver());
}
int num_clicks(string& s) {
  int p = (int)(s).size();
  int res = 0;
  if (is_str_in_trie(s)) {
    res = add_str(s);
  } else {
    res = add_new_str(s);
  }
  return res;
}
vertex make_ver() {
  vertex v;
  memset(v.next, 255, sizeof(v.next));
  v.flag = false;
  v.cou = 0;
  return v;
}
int add_str(const string& s) {
  int res = (int)(s).size();
  int num = 0;
  for (int i = 0; i < s.size(); ++i) {
    char ch = s[i] - 'a';
    num = trie[num].next[ch];
    if (trie[num].cou == 1) {
      int num1 = num;
      string ft = "";
      while (trie[num1].flag != true) {
        for (int g = 0; g < 26; ++g) {
          if (trie[num1].next[g] != -1) {
            ft += char('a' + g);
            num1 = trie[num1].next[g];
            break;
          }
        }
      }
      bool flag = true;
      if (i + (int)(ft).size() > (int)(s).size()) flag = false;
      for (int j = i + 1, g = 0; j < (int)(s).size() && g < (int)(ft).size();
           ++j, ++g) {
        if (ft[g] != s[j]) {
          flag = false;
          break;
        }
      }
      if (flag) {
        res -= max((int)(ft).size() - 1, 0);
      }
      return res;
    }
  }
  return res;
}
int add_new_str(const string& s) {
  bool fflag = true;
  int res = (int)(s).size();
  int num = 0;
  for (int i = 0; i < s.size(); ++i) {
    char ch = s[i] - 'a';
    if (trie[num].next[ch] == -1) {
      trie.push_back(make_ver());
      trie[num].next[ch] = trie.size() - 1;
      num = trie[num].next[ch];
    } else {
      num = trie[num].next[ch];
      if (trie[num].cou == 1 && fflag) {
        fflag = false;
        int num1 = num;
        string ft = "";
        while (trie[num1].flag != true) {
          for (int g = 0; g < 26; ++g) {
            if (trie[num1].next[g] != -1) {
              ft += char('a' + g);
              num1 = trie[num1].next[g];
              break;
            }
          }
        }
        bool flag = true;
        if (i + (int)(ft).size() + 1 > (int)(s).size()) flag = false;
        for (int j = i + 1, g = 0; j < (int)(s).size() && g < (int)(ft).size();
             ++j, ++g) {
          if (ft[g] != s[j]) {
            flag = false;
            break;
          }
        }
        if (flag) {
          res -= max((int)(ft).size() - 1, 0);
        }
      }
    }
    trie[num].cou++;
  }
  trie[num].flag = true;
  return res;
}
bool is_str_in_trie(const string& s) {
  int num = 0;
  for (int i = 0; i < s.size(); ++i) {
    char ch = s[i] - 'a';
    if (trie[num].next[ch] == -1) {
      return false;
    }
    num = trie[num].next[ch];
  }
  if (trie[num].flag == false) {
    return false;
  } else {
    return true;
  }
}
