#include <iostream>
#include <map>
using namespace std;
int appearTimes(string x,string y){
    int i=0;
    int r=0;
    while(i<x.length()){
        if(x.find(y,i)==string::npos) break;
        else {
            i=x.find(y,i)+1;
            r++;
        }
    }
    return r;
}
map<string,int> times;
int main() {
    string x;
    while(cin>>x){
        times.clear();
        times["0"]=appearTimes(x, "0");
        times["1"]=appearTimes(x, "1");
        for(int i=0;i<x.length();i++){
            for(int j=2;i+j<=x.length();j++){
                string n=x.substr(i,j);
                times[n]=appearTimes(x, n);
            }
        }
        for(map<string,int>::iterator i=times.begin();i!=times.end();
        i++){
            if(i->second>1){
                cout<<i->first<<' '<<i->second<<endl;
            }
        }
    }
}