#include <iostream>
#include <map>
using namespace std;
int main() {
string str;
while (cin >>str) {
map<string,int> number;
int len=str.size();
for(int i=0;i<len;i++)//子串开始位置
{
for(int j=1;j<=len-i;j++)//子串长度
{
string str1=str.substr(i,j);
number[str1]+=1;
}
}
map<string,int>::iterator it;//传闻中的迭代器
for(it=number.begin();it!=number.end();it++)//只能用!=
{
if(it->second>1)
cout<<it->first<<" "<<it->second<<endl;
}
}
}

京公网安备 11010502036488号