#include <bits/stdc++.h>
using namespace std;
vector<string> sol;
string ans;
int n;
void Print() {
  cout << sol.size() << endl;
  for (auto x : sol) cout << x << endl;
}
void solve(int pos, int mx) {
  if (pos == n) {
    sol.push_back(ans);
    return;
  }
  for (int i = 0; i <= pos && i <= mx + 1; i++) {
    ans += ('a' + i);
    solve(pos + 1, max(mx, i));
    ans.pop_back();
  }
}
int main() {
  cin >> n;
  solve(0, 0);
  Print();
}
