#include <iostream>
#include <map>
using namespace std;

struct dic {
    string key;
    int cnt = 0;
};

int main() {
    
    string s;
    while (cin >> s) { // 注意 while 处理多个 case
        map<string, int> myMap;  // ps:int的初始值尾0
        int len = s.length();
        string sub = "";
        for (int i = 0; i<len; i++) {
            for (int j = i; j<len; j++) {
                myMap[s.substr(i, j-i+1)]++;
            }
        }
        for (map<string, int>::iterator it = myMap.begin(); it!=myMap.end(); it++) {
            // 要注意map底层使用红黑树来实现,所以map的排序刚好是按照string的字典序进行排序,和题目符合。
            if (it->second > 1) {
                cout << it->first << " " << it->second << endl;
            }
        }
        return 0;
    }
}
// 64 位输出请用 printf("%lld")