#include <bits/stdc++.h>
using namespace std;
vector<pair<string, int>> ans(int n) {
  cout << n << endl;
  if (n == 1) return vector<pair<string, int>>(1, make_pair("a", 1));
  auto sub = ans(n - 1);
  vector<pair<string, int>> ret;
  for (auto itr = sub.begin(); itr != sub.end(); itr++) {
    for (int i = 0; i < itr->second; i++) {
      ret.push_back(*itr);
      ret.rbegin()->first.push_back('a' + i);
    }
    ret.push_back(*itr);
    ret.rbegin()->first.push_back('a' + itr->second);
    ret.rbegin()->second++;
  }
  return ret;
}
int main(void) {
  int N;
  cin >> N;
  auto r = ans(N);
  for (auto itr = r.begin(); itr != r.end(); itr++) {
    cout << itr->first << endl;
  }
  return 0;
}
