#include <iostream>
#include "map"
using namespace std;
int main() {
string line;
while (cin >> line) { // 注意 while 处理多个 case
// cout << a + b << endl;
map<string, int> strMap;
for (int i = 0; i <= line.size() - 1; i++) {//起点
for (int j = 1; j <= line.size() - i; j++) {//子串长度
string str = line.substr(i, j);
strMap[str]++;
}
}
for(auto it=strMap.begin();it!=strMap.end();it++){
if(it->second>=2) cout<<it->first<<' '<<it->second<<endl;
}
}
}
// 64 位输出请用 printf("%lld")

京公网安备 11010502036488号