#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
int n, p[30];
char s1[MAXN], s2[MAXN];
bool visit[30];
int Find(int u) { return u == p[u] ? u : p[u] = Find(p[u]); }
int main() {
  scanf("%d\n", &n);
  scanf("%s %s", s1, s2);
  for (int i = (1); i <= (26); i++) p[i] = i;
  for (int i = 0; i < (n); i++) {
    int u = s1[i] - 'a' + 1, v = s2[i] - 'a' + 1;
    visit[u] = visit[v] = true;
    u = Find(u), v = Find(v);
    if (u == v) continue;
    p[u] = v;
  }
  vector<int> V[30];
  for (int i = (1); i <= (26); i++)
    if (Find(i) == i) V[i].push_back(i);
  for (int i = (1); i <= (26); i++)
    if (Find(i) != i) V[Find(i)].push_back(i);
  int res = 0;
  for (int i = (1); i <= (26); i++)
    if ((int)V[i].size() > 1) res += (int)V[i].size() - 1;
  printf("%d\n", res);
  for (int i = (1); i <= (26); i++) {
    for (int j = (1); j <= ((int)V[i].size() - 1); j++) {
      printf("%c %c\n", V[i][0] + 'a' - 1, V[i][j] + 'a' - 1);
    }
  }
  return 0;
}
