#include <bits/stdc++.h>
using namespace std;
set<int> ranky[27];
int par[27];
int find(int i) {
  if (par[i] != i) par[i] = find(par[i]);
  return par[i];
}
void unio(int i, int j) {
  int x = find(i), y = find(j);
  if (x == y) return;
  par[y] = x;
  ranky[x].insert(ranky[y].begin(), ranky[y].end());
  return;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie();
  cout.tie();
  int n;
  cin >> n;
  string a, b;
  cin >> a;
  cin >> b;
  int ind = -1;
  for (int i = 0; i < 26; i++) ranky[i].insert(i), par[i] = i;
  for (int i = 0; i < n; i++) {
    if (a[i] != b[i]) {
      unio(a[i] - 'a', b[i] - 'a');
      ind++;
    }
  }
  if (ind == -1) {
    cout << 0 << endl;
    return 0;
  }
  vector<pair<int, int> > vec;
  for (int i = 0; i < 26; i++) {
    if (par[i] == i) {
      auto it = ranky[i].begin();
      int prev = *it;
      it++;
      for (; it != ranky[i].end(); it++) {
        vec.push_back({prev, *it});
        prev = *it;
      }
    }
  }
  cout << vec.size() << endl;
  for (auto it : vec)
    cout << char(it.first + 'a') << " " << char(it.second + 'a') << endl;
  return 0;
}
