#include <bits/stdc++.h>
using namespace std;
std::vector<vector<char> > v;
int first(char c) {
  int siz = v.size();
  for (int i = 0; i < siz; i++) {
    if (find(v[i].begin(), v[i].end(), c) != v[i].end()) return i;
  }
  std::vector<char> x;
  x.push_back(c);
  v.push_back(x);
  return siz;
}
void Print() {
  for (int i = 0; i < v.size(); i++) {
    for (int j = 0; j < v[i].size(); j++) cout << v[i][j] << " ";
    cout << endl;
  }
}
void Ins(char a, char b) {
  if (a == b) return;
  int i = first(a), j = first(b);
  if (i == j) return;
  v[i].insert(v[i].end(), v[j].begin(), v[j].end());
  v.erase(v.begin() + j);
}
int main() {
  int n;
  cin >> n;
  string s1, s2;
  cin >> s1 >> s2;
  for (int i = 0; i < n; i++) {
    Ins(s1[i], s2[i]);
  }
  int t = 0;
  for (int i = 0; i < v.size(); i++) {
    for (int j = 0; j < v[i].size() - 1; j++) t++;
  }
  cout << t << endl;
  for (int i = 0; i < v.size(); i++) {
    for (int j = 0; j < v[i].size() - 1; j++)
      cout << v[i][j] << " " << v[i][j + 1] << endl;
  }
  return 0;
}
