#include <bits/stdc++.h>
using namespace std;
long long int n;
vector<string> v;
void func(long long int k) {
  if (k == n) return;
  vector<string> temp;
  for (long long int i = 0; i < v.size(); i++) {
    string t = v[i];
    long long int cnt = 0;
    vector<long long int> vis(26, 0);
    for (long long int j = 0; j < t.length(); j++) {
      if (!vis[long long int(t[j] - 'a')]) cnt++;
      vis[long long int(t[j] - 'a')] = 1;
    }
    for (long long int j = 0; j <= min(k, cnt); j++) {
      string s = v[i];
      s.push_back(char('a' + j));
      temp.push_back(s);
    }
  }
  v = temp;
  func(k + 1);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  v.push_back("a");
  func(1);
  cout << v.size() << endl;
  for (long long int i = 0; i < v.size(); i++) cout << v[i] << endl;
}
