#include<iostream>
using namespace std;
#include<string>
#include<map>
int main() {
	string s; cin >> s;
	map<string, int>m;
	for (int i = 0; i < s.size(); i++) {
		for (int j = 1; j <= s.size()-i; j++) {
			m[s.substr(i, j)]++;
		}
	}
	for (auto it = m.begin(); it != m.end(); it++) {
		if (it->second > 1)
			cout << it->first << " " << it->second << endl;
	}

	return 0;
}