#include<string>
#include<map>

using namespace std;

int main()
{
    string s;
    cin >> s;
    map<string, int> m; //构建散列表
    for (int i = 0; i < s.size(); i++)
    {
        for (int j = 0; j <= i; j++)
        {
            m[s.substr(j, i-j+1)]++;
        }
    }
    map<string, int>::iterator it; //定义迭代器
    for (it = m.begin(); it != m.end(); it++)
    {
        if(it->second > 1)
            cout << it->first << " " << it->second << endl;
    }
    return 0;
}