#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int inf = 1e8;
const long long INF = 1e16;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
int main() {
  int N;
  cin >> N;
  vector<pair<string, int> > vec[N + 1];
  vec[1].push_back(make_pair("a", 0));
  for (int i = 2; i <= N; i++) {
    for (auto &e : vec[i - 1]) {
      string c = e.first;
      for (int j = 0; j < e.second + 1; j++) {
        vec[i].push_back(make_pair(c + alpha[j], e.second));
      }
      vec[i].push_back(make_pair(c + alpha[e.second + 1], e.second + 1));
    }
  }
  cout << vec[N].size() << endl;
  for (auto &e : vec[N]) {
    cout << e.first << endl;
  }
}
