#include "iostream"
#include "map"
using namespace std;
int main() {
string input;
while (cin >> input) {
// 10101 DEVIDE INTO
// 1 0 1 0 1
// 10 01 10 01
// 101 010 101
// 1010 0101
map<string, int> myMap;
for (int start = 0; start < input.size(); start++) // 分割起点
for (int length = 1; length <= input.size() - start; length++) // 每次分割后得到的字串长度
myMap[input.substr(start, length)]++;
for (auto itor = myMap.begin(); itor != myMap.end(); itor++) {
if(itor->second<=1) continue;
cout << itor->first << " " << itor->second << endl;
}
}
return 0;
}