#include <bits/stdc++.h>
using namespace std;
int par[30], siz[30];
int getPar(int u) { return par[u] == u ? u : par[u] = getPar(par[u]); }
vector<pair<char, char> > vec;
int main() {
  int n;
  cin >> n;
  string s, t;
  cin >> s >> t;
  for (int i = 1; i <= 26; ++i) par[i] = i, siz[i] = 1;
  for (int i = 0; i < n; ++i) {
    if (s[i] == t[i]) continue;
    int x = s[i] - 'a' + 1;
    int y = t[i] - 'a' + 1;
    x = getPar(x);
    y = getPar(y);
    if (x == y) continue;
    par[y] = x;
    siz[x] += siz[y];
  }
  int ans = 0;
  for (int i = 1; i <= 26; ++i) {
    if (par[i] == i) {
      ans += siz[i] - 1;
      for (int j = 1; j <= 26; ++j) {
        if (getPar(j) == i && j != i) vec.push_back({'a' + j - 1, 'a' + i - 1});
      }
    }
  }
  cout << ans << endl;
  for (int i = 0; i < vec.size(); ++i)
    cout << vec[i].first << " " << vec[i].second << endl;
  return 0;
}
