#include <bits/stdc++.h>
using namespace std;
long dsu_father[30] = {};
long dsu_size[30] = {};
long dsu_get(long x) {
  if (dsu_father[x] == x)
    return x;
  else {
    return dsu_get(dsu_father[x]);
  }
}
void dsu_union(long x, long y) {
  long a = dsu_get(x), b = dsu_get(y);
  if (a == b) return;
  if (rand() % 2) swap(a, b);
  dsu_father[a] = b;
  dsu_size[a] += dsu_size[b];
  dsu_size[b] = 0;
}
void dsu_init() {
  for (long long f = (long long)(0); f <= (long long)(29); ++f) {
    dsu_size[f] = 1;
    dsu_father[f] = f;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(15);
  srand(time(0));
  dsu_init();
  long n, ans = 0;
  string a, b;
  cin >> n;
  cin >> a;
  cin >> b;
  for (long long f = (long long)(0); f <= (long long)(n - 1); ++f) {
    dsu_union(a[f] - 'a', b[f] - 'a');
  }
  vector<long> v[30];
  for (long long f = (long long)(0); f <= (long long)(29); ++f) {
    long tmp = dsu_get(f);
    if ((long)(v[tmp]).size()) ans++;
    v[tmp].push_back(f);
  }
  cout << ans << '\n';
  for (long long f = (long long)(0); f <= (long long)(29); ++f) {
    if ((long)(v[f]).size() > 1) {
      for (long long ff = (long long)(1);
           ff <= (long long)((long)(v[f]).size() - 1); ++ff) {
        cout << (char)(v[f][ff - 1] + 'a') << ' ' << (char)(v[f][ff] + 'a')
             << '\n';
      }
    }
  }
  return 0;
}
