#include <bits/stdc++.h>
using namespace std;
long long M = 1e9 + 7;
vector<long long int> par(50);
vector<long long int> sz(50);
vector<pair<char, char> > ans;
void init() {
  for (long long int i = 0; i < 50; i++) {
    par[i] = i;
    sz[i] = 1;
  }
}
long long int root(long long int x) {
  if (x == par[x]) return x;
  return par[x] = root(par[x]);
}
void Union(long long int x, long long int y) {
  long long int rx = root(x);
  long long int ry = root(y);
  if (rx == ry) return;
  if (sz[rx] < sz[ry]) {
    par[rx] = ry;
    sz[ry] += sz[rx];
  } else {
    par[ry] = rx;
    sz[rx] += sz[ry];
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  init();
  long long int n;
  cin >> n;
  string a, b;
  cin >> a >> b;
  long long int h[26] = {};
  for (long long int i = 0; i < n; i++) {
    h[a[i] - 'a']++;
    h[b[i] - 'a']++;
    if (a[i] != b[i]) {
      Union(a[i] - 'a', b[i] - 'a');
    }
  }
  map<long long int, vector<long long int> > mp;
  for (long long int i = 0; i < 26; i++) {
    if (h[i] == 0) continue;
    long long int ri = root(i);
    if (ri != i) mp[ri].push_back(i);
  }
  for (auto x : mp) {
    char a = x.first + 'a';
    for (auto y : x.second) {
      char b = y + 'a';
      ans.push_back({a, b});
    }
  }
  cout << ans.size() << "\n";
  for (auto x : ans) {
    cout << x.first << " " << x.second << "\n";
  }
}
