#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int main(){
	while(1){
		string s; cin >> s; if(s=="#") return 0;
		set<string>S; S.insert(s);
		for(int i=24;i>=0;i--){
			vector<string>vs;
			for(set<string>::iterator it = S.begin();it != S.end();++it){
				string s2 = *it;
				for(int j=0;j<s2.size();j++){
					if(s2[j] == 'a'+(i+1)) goto fail;
					if(s2[j] == 'a'+i){
						string s3 = s2;
						s3[j] = 'a'+(i+1);
						vs.pb(s3);
					}
				}vs.pb(s2); fail:;
			}
			S.clear();
			for(int j=0;j<vs.size();j++){
				if(S.find(vs[j]) == S.end()) S.insert(vs[j]);
			}
		}
		cout << S.size() << endl;
		if(S.size()<=10){
			for(set<string>::iterator it = S.begin();it != S.end();++it){
				cout << *it << endl;
			}
		}
		else{
			int c = 0;
			for(set<string>::iterator it = S.begin();;++it){
				cout << *it << endl; c++;
				if(c == 5) break;
			}c = 0;
			set<string>::iterator it = S.end(); it--;it--;it--;it--;it--;
			for(;;++it){
				cout << *it << endl; c++;
				if(c == 5) break;
			}
		}
		
	}
}