#include<iostream>
#include<map>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
string str;
while(cin >> str){
map<string,int> mp;
for(int i = 0;i < str.size();++i){
for(int j = 1;j <= str.size() - i;++j){
mp[str.substr(i,j)]++;
}
}
for(auto it : mp){
if(it.second > 1)
cout << it.first << " " << it.second << endl;
}
}
}