#include <vector>
#include <string>
#include <algorithm>
#include <iostream>
using namespace std;
string enc;
vector<string> decoding;

void dfs(int index, string s){
	if(index == enc.size()){
		vector<bool> use_moji(26,false);
		use_moji[0] = true;
		bool is_match = true;
		for(int i=0;i<enc.size();i++){
			int moji_index = s[i] - 'a';
			if(use_moji[moji_index] == false && (char)(s[i]-1) == enc[i]){
				use_moji[moji_index] = true;
			}else if(use_moji[moji_index] == true && s[i] == enc[i]){
			}else{
				is_match = false;
				break;
			}
		}
		if(is_match)decoding.push_back(s);
		return;
	}
	/*	cout << s + char(enc[index] + 1) << endl;
			cout << s + enc[index] << endl;*/
	if(enc[index] !='z'){
		dfs(index + 1,s + char(enc[index] + 1));
	}
	dfs(index + 1,s + enc[index]);
	return;
}
int main(){

	while(cin >> enc,enc[0]!='#'){
		string s;
		dfs(0,s);
		cout << decoding.size() << endl;
		sort(decoding.begin(),decoding.end());
		if(decoding.size() <= 10){
			for(int i=0;i<decoding.size();i++)
				cout << decoding[i] << endl;
		}else{
			for(int i=0;i<5;i++){
				cout << decoding[i] << endl;
			}
			for(int i=decoding.size()-5;i<decoding.size();i++){
				cout << decoding[i] << endl;
			}
		}
		decoding.clear();
	}
}