#include <bits/stdc++.h>
using namespace std;
int const N = 300;
int parent[N];
int cnt[N];
pair<int, pair<int, int> > a[N];
int fn(int x) {
  if (parent[x] != x) return parent[x] = fn(parent[x]);
  return x;
}
void unio(int x, int y) { parent[fn(x)] = fn(y); }
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= N; i++) {
    parent[i] = i;
  }
  vector<pair<char, char> > v;
  string s;
  string x;
  cin >> s >> x;
  for (int i = 0; i < n; i++) {
    if (s[i] != x[i]) {
      int a = (s[i]);
      int b = (x[i]);
      if (fn(b) != fn(a)) {
        v.push_back({parent[a], parent[b]});
        unio(parent[a], parent[b]);
      }
    }
  }
  cout << v.size() << endl;
  for (int i = 0; i < v.size(); i++) {
    cout << v[i].first << " " << v[i].second << endl;
  }
}
