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

map<string, int> cnt; //自动初始化

int main() {
    string str;
    while(cin >> str) {
        for(int i = 1;i <= str.length(); i++) {
            for(int j = 0;j < i; j++) {
                string s = str.substr(j, i - j);
                cnt[s]++;
            } //获取子串:外层i是子串长度,内层j是子串开始的位置。i - j + j == i
        }
        for(auto iter = cnt.begin(); iter != cnt.end(); iter++) {
            if(iter->second > 1){
                cout << iter->first << ' ' << iter->second << endl;
            }
        }
    }
    
    return 0;
}