#include <map>
#include <set>
#include <list>
#include <cstdio>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <cctype>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define fr first
#define sc second
#define mp make_pair

typedef long long int64;
typedef pair< int, int > iP;
typedef pair< iP, int > iiP;

const int INF = 2 << 28;
const double EPS = 1e-10;

string s;
vector< string > ans;
int cnt;

bool f;
void encode(string now, char c) {
    if(c == 'z' + 1) {
        if(now == s.substr(0, now.size())) f = true;
        return;
    }
    bool rep = true;
    for(int i = 0; i < now.size(); i++) {
        if(now[i] == c) {
            now[i] = c - 1;
            if(now[i] == s[i]) encode(now, c + 1);
            now[i] = c;
            rep = false;
            break;
        }
    }
    if(rep) encode(now, c + 1);
}

void rec(string now) {

    f = false;
    encode(now, 'b');
    if(!f) return;

    if(now.size() == s.size()) {
        cnt++;
        ans.push_back(now);
        if(ans.size() > 10) ans.erase(ans.begin() + 5);
        return;
    }

    char r = s[now.size()];
    rec(now + r);
    if(s[now.size()] != 'z') rec(now + (char)(r + 1));
}

int main() {

    while(cin >> s, s != "#") {
        cnt = 0;
        rec("");
        cout << cnt << endl;
        for(int i = 0; i < ans.size(); i++) {
            cout << ans[i] << endl;
        }
        ans.clear();
    }
}