#include <string>
#include <vector>
using namespace std;
int str_zip(string s, int n) {
string new_s;
string tmp = s.substr(0, n);
int count = 0, i;
for (i = n; i < s.size(); i += n) {
if (tmp.compare(s.substr(i, n)) == 0) {
count++;
}
else {
if (count > 0)
new_s.append(to_string(count+1) + tmp);
else new_s.append(tmp);
tmp = s.substr(i, n);
count = 0;
}
}
if (count > 0)
new_s.append(to_string(count + 1) + tmp);
else new_s.append(tmp);
return new_s.size();
}
int solution(string s) {
int size = s.size() / 2;
int min_size = s.size();
int tmp;
for (int i = 1; i <= size; i++) {
tmp = str_zip(s, i);
if (min_size > tmp)
min_size = tmp;
}
return min_size;
}