#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
constexpr long long INF = LLONG_MAX / 10;
constexpr double eps = 1e-9;
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
  if (lhs < rhs) {
    lhs = rhs;
    return 1;
  }
  return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
  if (lhs > rhs) {
    lhs = rhs;
    return 1;
  }
  return 0;
}
using namespace std;
inline long long gcd(long long a, long long b) {
  while (b) {
    long long c = a;
    a = b;
    b = c % b;
  }
  return a;
}
inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
bool isprime(long long n) {
  if (n == 1) return false;
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}
long long mypow(long long a, long long b) {
  if (!b) return 1;
  if (b & 1) return mypow(a, b - 1) * a;
  long long memo = mypow(a, b >> 1);
  return memo * memo;
}
long long n, a[26];
vector<string> vec;
string ans;
void func(long long m) {
  if (m == n) {
    vec.push_back(ans);
    return;
  }
  ans += 'a';
  a[0]++;
  func(m + 1);
  ans.pop_back();
  a[0]--;
  for (long long i = 1; i <= (25); i++) {
    if (a[i]) {
      ans += 'a' + i;
      a[i]++;
      func(m + 1);
      ans.pop_back();
      a[i]--;
    } else if (i) {
      if (a[i - 1]) {
        ans += 'a' + i;
        a[i]++;
        func(m + 1);
        ans.pop_back();
        a[i]--;
      }
    }
  }
}
signed main() {
  cin >> n;
  func(0);
  cout << vec.size() << endl;
  for (string s : vec) cout << s << endl;
  return 0;
}
