#include <bits/stdc++.h>
using namespace std;
char reps[256];
char repr(char i) {
  if (reps[i] != i) {
    return reps[i] = repr(reps[i]);
  }
  return i;
}
bool ss(char a, char b) { return repr(a) == repr(b); }
void join(char a, char b) {
  char ra = repr(a);
  char rb = repr(b);
  reps[ra] = rb;
}
int main() {
  for (int i = 0; i < 256; ++i) reps[i] = i;
  int n;
  string a, b;
  cin >> n;
  vector<pair<char, char>> res;
  std::getline(cin, a);
  std::getline(cin, a);
  std::getline(cin, b);
  for (int i = 0; i < n; ++i) {
    if (!ss(a[i], b[i])) {
      join(a[i], b[i]);
      res.emplace_back(a[i], b[i]);
    }
  }
  cout << res.size() << '\n';
  for (auto &i : res) {
    cout << i.first << ' ' << i.second << '\n';
  }
}
