#include<memory>
#include<string>
#include<iostream>
#include<vector>
using namespace std;
int code(string s) {
if (s.size() < 4)
return s.size();
vector<pair<string, int>> k;
for (size_t i = 1; i <= s.size() / 2; i++) {
string tmp(s.begin(), s.begin() + i);
k.push_back(make_pair(tmp, 1));
}
for (auto it = k.begin(); it != k.end(); it++) {
size_t len = (it->first).size();
for (size_t m = len; m+len<s.size()+1; m += len) {
string tmp(s.begin() + m, s.begin() + m + len);
if (it->first == tmp)
it->second++;
else
break;
}
}
auto max_index = k.end();
size_t max = 0;
for (auto it = k.begin(); it != k.end(); it++) {
if (it->second >= 2) {
size_t len = ((it->first).size())*(it->second);
if (len > max && (len > (it->first).size() + 3)) {
max_index = it;
max = len;
}
}
}
if (max_index != k.end()) {
string tmp(s.begin() + max, s.end());
return (code(max_index->first) + 3 + code(tmp));
}
else {
string tmp(s.begin() + 1, s.end());
return (1 + code(tmp));
}
return s.size();
}
int main()
{
string in;
cin >> in;
cout << code(in);
return 0;
}