#include <iostream>
#include <map>
#include <string>
using namespace std;
int main() {
ios::sync_with_stdio(false);
string str;
int n;
map<string,int>m;
map<string,int>::iterator it;
while (cin >> str)
{
n=str.size();
for(int i=1;i<=n;++i)
{
for(int j=0;j<=n-i;++j)
{
++m[str.substr(j,i)];
}
}
it=m.begin();
while(it!=m.end())
{
if(1<it->second)
{
cout<<it->first<<" "<<it->second<<endl;
}
it++;
}
}
}
// 64 位输出请用 printf("%lld")

京公网安备 11010502036488号