#include <iostream>
#include<map>
using namespace std;
map<string ,int> mp; //定义键值对容器
int main() {
string s;
cin>>s;
int n=s.size();
for(int i=0;i<n;i++){ //遍历字符串 (子串头)
string str;
for(int j=i;j<n;j++){ //(子串尾)
str+=s[j]; //子串
mp[str]++; //对应的键值对加1
}
}
for(auto t:mp){ //遍历mp
if(t.second>1){
cout<<t.first<<" "<<t.second<<endl;
}
}
}
// 64 位输出请用 printf("%lld")

京公网安备 11010502036488号