#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<functional>
#include<ctime>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>

using namespace std;

#define rep(i,a,b) for(unsigned (i)=(a);(i)<(b);(i)++)
#define ull unsigned long long
#define sharp '#'
#define ZERO 'a'
#define ZET 'z'
#define ALPHA_NUM 26

string correct;
vector<string> answer;
bool flag[ALPHA_NUM+1];

//void fix_step(void){
//	string tmp = test;
//	bool flag[ALPHA_NUM] = { true };
//	rep(i, 0, correct.length())
//		if (!flag[(unsigned)test[i] - ZERO]){
//			flag[(unsigned)test[i] - ZERO] = true;
//		test[i]--;
//
//	}
//		if (correct.compare(test) == 0)answer.push_back(tmp);
//
//}

void func(const char* str, unsigned pt){
	string test = string(str);
	//cout << test << endl;
	if (pt == correct.length()){
		answer.push_back(test);
		return;
	}
	if (flag[correct[pt] - ZERO]){
		string tmp = test + correct[pt];
		func(tmp.c_str(), pt + 1);
	}
	if (!flag[correct[pt] - ZERO + 1]){
		string tmp = test + (++correct[pt]);
		--correct[pt];
		flag[correct[pt] - ZERO + 1] = true;
		func(tmp.c_str(), pt + 1);
		flag[correct[pt] - ZERO + 1] = false;
	}
}

int main(void){
	flag[0] = flag[ALPHA_NUM] = true;
	while (true){
		cin >> correct;
		if (correct[0] == sharp)return(0);
		answer.clear();
		rep(i, 1, ALPHA_NUM)flag[i] = false;
		func("", 0);
		cout << answer.size() << endl;
		if (answer.size() <= 10)rep(i, 0, answer.size())cout << answer[i] << endl;
		else{
			rep(i, 0, 5)cout << answer[i] << endl;
			rep(i, answer.size() - 5, answer.size())cout << answer[i] << endl;
		}
	}
	return(0);



}