#include <bits/stdc++.h>
using namespace std;
int PressCount = 0;
bool WordBeginningFound = false;
class TreeNode {
 public:
  TreeNode* Nodes[128] = {nullptr};
  bool UniqueWord = false;
  char OtherChild = 0;
};
inline bool IsDelim(char c) {
  return c == ' ' || c == '.' || c == ',' || c == '?' || c == '!' ||
         c == '\'' || c == '-' || c == '\n';
}
int main() {
  char c;
  TreeNode* head = new TreeNode;
  TreeNode* current_node = head;
  while (cin.get(c)) {
    PressCount++;
    if (IsDelim(c)) {
      current_node = head;
    } else {
      if (current_node->Nodes[c] == nullptr) {
        current_node->Nodes[c] = new TreeNode;
        current_node = current_node->Nodes[c];
        cin.get(c);
        if (!IsDelim(c) && c != EOF) {
          PressCount++;
          current_node->UniqueWord = true;
          current_node->OtherChild = c;
          current_node->Nodes[c] = new TreeNode;
          current_node = current_node->Nodes[c];
          cin.get(c);
          while (!IsDelim(c) && c != EOF) {
            PressCount++;
            current_node->OtherChild = c;
            current_node->Nodes[c] = new TreeNode;
            current_node = current_node->Nodes[c];
            cin.get(c);
          }
        }
        current_node = head;
        if (c != EOF) {
          PressCount++;
        }
      } else {
        current_node = current_node->Nodes[c];
        if (current_node->UniqueWord) {
          TreeNode* unique_node = current_node;
          int CharactersTyped = 0;
          cin.get(c);
          while (!IsDelim(c) && c != EOF) {
            CharactersTyped++;
            if (current_node->Nodes[c] != nullptr) {
              current_node = current_node->Nodes[c];
            } else {
              unique_node->UniqueWord = false;
              if (current_node->OtherChild != 0) {
                PressCount += CharactersTyped;
                TreeNode* tmp_node =
                    current_node->Nodes[current_node->OtherChild];
                if (tmp_node->OtherChild != 0) {
                  tmp_node->UniqueWord = true;
                }
              } else {
                PressCount += 2;
              }
              CharactersTyped = -1;
              current_node->Nodes[c] = new TreeNode;
              current_node = current_node->Nodes[c];
              cin.get(c);
              if (!IsDelim(c) && c != EOF) {
                PressCount++;
                current_node->UniqueWord = true;
                current_node->OtherChild = c;
                current_node->Nodes[c] = new TreeNode;
                current_node = current_node->Nodes[c];
                cin.get(c);
                while (!IsDelim(c) && c != EOF) {
                  PressCount++;
                  current_node->OtherChild = c;
                  current_node->Nodes[c] = new TreeNode;
                  current_node = current_node->Nodes[c];
                  cin.get(c);
                }
                current_node = head;
              }
              break;
            }
            cin.get(c);
          }
          if (c != EOF) {
            PressCount++;
          }
          if (current_node->OtherChild != 0) {
            unique_node->UniqueWord = false;
            TreeNode* tmp_node = current_node->Nodes[current_node->OtherChild];
            if (tmp_node->OtherChild != 0) {
              tmp_node->UniqueWord = true;
            }
            PressCount += CharactersTyped;
          } else {
            if (CharactersTyped != -1) {
              PressCount++;
            }
          }
          current_node = head;
        }
      }
    }
  }
  cout << PressCount;
  return 0;
}
