#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e6 + 20, mod = 1e9 + 7, inf = 1e9;
long long n, m, x1, yy, x2, y2, x, y, d, z, mini, t, pos, ans, par[MAXN],
    sz[MAXN];
string s1, s2;
vector<pair<char, char> > v;
long long getpar(long long x) {
  return (par[x] == x ? x : par[x] = getpar(par[x]));
}
void _merge(long long x, long long y) {
  x = getpar(x);
  y = getpar(y);
  if (sz[x] < sz[y]) {
    swap(x, y);
  }
  par[y] = x;
  sz[x] += sz[y];
}
int main() {
  cin >> n >> s1 >> s2;
  for (int i = 0; i < n; i++) {
    sz[s1[i]] = 1;
    sz[s2[i]] = 1;
    par[s1[i]] = s1[i];
    par[s2[i]] = s2[i];
  }
  for (int i = 0; i < n; i++) {
    x = getpar(s1[i]);
    y = getpar(s2[i]);
    if (x != y) {
      _merge(s1[i], s2[i]);
      v.push_back(make_pair(s1[i], s2[i]));
    }
  }
  cout << (long long)v.size() << endl;
  for (int i = 0; i < v.size(); i++) {
    cout << (char)v[i].first << " " << (char)v[i].second << endl;
  }
}
