#include <iostream> #include <vector> #include <algorithm> #include <map> using namespace std; string str; map<string, int> tree_map; int main() { cin >> str; for (int i = 0; i < str.size(); ++i) for (int j = i; j < str.size(); ++j) { string t = str.substr(i, j - i + 1); tree_map[t]++; } for (auto [u, v] : tree_map) if (v > 1) cout << u << ' ' << v << endl; return 0; }