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