#include <bits/stdc++.h> using namespace std; typedef unsigned long long ULL; const int N = 200, P = 13331; ULL p[N], h[N]; ULL get(int l, int r){ return h[r] - h[l-1] * p[r-l+1]; } int main(){ string str1; cin >> str1; string str2 = " "; string str = str2 + str1; int n = str.size()-1; map<string, int> mp; h[0] = 0; p[0] = 1; for (int i=1; i<=n; i++){ p[i] = p[i-1] * P; h[i] = h[i-1] * P + str[i]; } for (int i=1; i<=n; i++){ for (int j=0; j<=n-i+1; j++){ mp[str.substr(i,j)]++; } } for (auto item : mp){ if (item.second > 1 && item.first != "\0"){ cout << item.first << " " << item.second << endl; } } return 0; }