#include <bits/stdc++.h>
using namespace std;
struct node {
  int x, y;
} ans[1050000];
char a[1050000];
char b[1050000];
int f[1050000];
int find(int a) {
  int r = a;
  while (f[r] != r) r = f[r];
  int i = a;
  int j;
  while (i != r) {
    j = f[i];
    f[i] = r;
    i = j;
  }
  return r;
}
void merge(int a, int b) {
  int A, B;
  A = find(a);
  B = find(b);
  if (A != B) f[B] = A;
}
int main() {
  int n;
  while (~scanf("%d", &n)) {
    int cont = 0;
    for (int i = 0; i <= 26; i++) f[i] = i;
    scanf("%s", a);
    scanf("%s", b);
    for (int i = 0; i < n; i++) {
      int u = a[i] - 'a' + 1;
      int v = b[i] - 'a' + 1;
      if (find(u) == find(v))
        continue;
      else {
        ans[cont].x = u;
        ans[cont].y = v;
        cont++;
        merge(u, v);
      }
    }
    printf("%d\n", cont);
    for (int i = 0; i < cont; i++) {
      printf("%c %c\n", ans[i].x - 1 + 'a', ans[i].y - 1 + 'a');
    }
  }
}
