#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MOD = 100000009;
const int maxn = (int)1e6 + 7;
int main() {
  long long n, k;
  scanf("%lld", &n);
  char ss[maxn], ss2[maxn];
  scanf("%s", ss);
  scanf("%s", ss2);
  int a[28] = {0};
  int i1, i2;
  int cnt = 1;
  int ans = 0;
  int res[28][28] = {0};
  memset(res, -1, sizeof(res));
  for (int i = 0; i < (n); i++) {
    i1 = ss[i] - 'a';
    i2 = ss2[i] - 'a';
    if (i1 == i2) continue;
    if (a[i1] == 0 && a[i2] == 0) {
      a[i1] = cnt;
      a[i2] = cnt;
      cnt++;
      ans++;
    } else if (a[i1] != a[i2]) {
      if (a[i1] == 0) a[i1] = a[i2], ans++;
      if (a[i2] == 0) a[i2] = a[i1], ans++;
    }
    if (a[i1] != a[i2]) {
      ans++;
      int b = a[i2];
      for (int j = 0; j < 26; j++) {
        if (a[j] == b) a[j] = a[i1];
      }
    }
  }
  for (int i = 1; i < cnt; i++) {
    int cntt = 0;
    for (int j = 0; j < (26); j++) {
      if (a[j] == i) res[i][cntt++] = j;
    }
  }
  cout << ans << endl;
  for (int i = 1; i < cnt; i++) {
    for (int j = 1; res[i][j] != -1; j++) {
      cout << char('a' + res[i][j - 1]) << " " << char('a' + res[i][j]) << endl;
    }
  }
}
