#include <bits/stdc++.h>
using namespace std;

int cnt = 0;
vector<string> ret;
queue<string> backret;
void dfs(int i,vector<char>& v,map<char,int>& st,string& ans,const string& s) {
  if (i == s.size()){
    cnt++;
    backret.push(ans);
    while(backret.size() > 5){
      backret.pop();
    }
    if(ret.size() < 10)ret.push_back(ans);
    return;
  }
    
  string oldans = ans;
  char c = s[i];
  char nextc;

  nextc = c;
  if(st[nextc] > 0 || nextc == 'a'){
    st[nextc]++;v.push_back(nextc);
    ans += nextc;
    dfs(i+1,v,st,ans,s);
    ans = oldans;
    st[nextc]--;v.pop_back();
  }

  // ????????????????????????????????£??? 'a' <- 'b'
  nextc = c + 1;
  if(c != 'z' && st[nextc] == 0){
      st[nextc]++;v.push_back(nextc);
      ans += nextc;
      dfs(i+1,v,st,ans,s);
      ans = oldans;
      st[nextc]--;v.pop_back();
  }
}

bool solve(){
  string s;
  cin >> s;
  if(s == "#")return false;
  vector<char> v;
  map<char,int> st;
  string ans;
  cnt = 0;
  backret = queue<string>();
  ret = vector<string>();
  dfs(0,v,st,ans,s);
  cout << cnt << endl;
  if(cnt <= 10){
    for(int i=0;i<ret.size();i++){
      cout << ret[i] << endl;
    }
  }else{
    for(int i=0;i<5;i++){
      cout << ret[i] << endl;
    }
    while(!backret.empty()){
      cout << backret.front() << endl;
      backret.pop();
    }
  }
  return true;
}

int main(void) {
  while(solve()){}

  return 0;
}