#include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
while(cin >> s)
{
int n = s.size();
map<string, int> cnt;
for(int i = 0; i < n; i ++) //子串头
{
string t = "";
for(int j = i; j < n; j ++) //子串尾
{
t += s[j];
cnt[t] ++;
}
}
for(auto t : cnt)
{
if(t.second <= 1) continue;
cout << t.first << ' ' << t.second << endl;
}
}
return 0;
}