#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
vector<string> v;
string s;
bool check(string in){
	rep(i,25){
		rep(j,in.size()){
			if(in[j]=='b'+i){
				in[j]='b'+i-1;
				break;
			}
		}
	}
	if(in==s.substr(0,in.size())) return true;
	return false;
}
void foo(string in){
	if(s.size()==in.size()){
		if(check(in)) v.push_back(in);
		return;
	}
	string tmp=s.substr(in.size(),1);
	if(check(in+tmp)) foo(in+tmp);
	if(tmp[0]=='z') return;
	tmp[0]++;
	if(check(in+tmp)) foo(in+tmp);
	return;
}
int main(){
	while(cin>>s,s[0]!='#'){
		v.clear();
		foo("");
		sort(v.begin(),v.end());
		cout<<v.size()<<endl;
		if(v.size()<=10){
			rep(i,v.size()){
				cout<<v[i]<<endl;
			}
		}
		else{
			rep(i,5){
				cout<<v[i]<<endl;
			}
			rep(i,5){
				cout<<v[v.size()+i-5]<<endl;
			}
		}
	}
}