#include<iostream>
#include<vector>
#include<string>
using namespace std;
pair<int, string> fun(const string &str)
{
vector<string> substrs;
int maxcount = 1;
int count =1;
string substr;
int i, len = str.length();
for (i = 0; i < len; ++i)
{
substrs.push_back(str.substr(i, len - i));
}
for (i = 0; i < len; ++i)
{
for (int j = i + 1; j < len; ++j)
{
count = 1;
if (substrs[i].substr(0, j - i) == substrs[j].substr(0, j - i))
{
++count;
for ( int k = j + (j - i); k < len; k+=j - i)
{
if ( substrs[i].substr(0, j - i) == substrs[k].substr(0, j - i))
{
++count;
}
else
{
break;
}
}
if (count > maxcount)
{
maxcount = count;
substr = substrs[i].substr(0, j - i);
}
}
}
}
return make_pair(maxcount, substr);
}
int main(void)
{
string str = "abcbcbcabc";
pair<int, string> rs;
rs = fun(str);
cout<<rs.second<<":"<<rs.first<<endl;
return 0;
}