#include<bits/stdc++.h>
using namespace std;

int main()
{
    string str;
    while(cin>>str)
    {
        int len = str.length();
        map<string, int> m;

        for(int i = 0;i<len;i++)
        {
            for(int j = i;j<len;j++)
            {
                m[str.substr(i,j-i+1)]++;
            }
        }

        for(auto it = m.begin();it != m.end();it++)
        {
            if(it->second>1)
            {
                cout<<it->first<<" "<<it->second<<endl;
            }
        }
    }
    return 0;
}