#include <bits/stdc++.h>
using namespace std;
map<string,int>cc;
int main() {
string s;
while(cin>>s)
{
//遍历所有子串
for(int i=0;i<s.length();i++)
{
for(int j=i;j<s.length();j++)
{
cc[s.substr(i,j-i+1)]++;//子串起点i,终点j,长度i-j+1
}
}
for(auto it=cc.begin();it!=cc.end();it++)
{
if((*it).second>1)
cout<<(*it).first<<" "<<(*it).second<<endl;
}
}
}
// 64 位输出请用 printf("%lld")



京公网安备 11010502036488号