#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int MAX = 100002;
vector<int> g[30];
vector<int> ans[100];
int cnt;
int idx;
bool vis[30];
void dfs(int u) {
  vis[u] = 1;
  if (g[u].size() == 0) return;
  ++cnt;
  ans[idx].push_back(u);
  for (int v : g[u]) {
    if (!vis[v]) dfs(v);
  }
}
int main() {
  int n;
  string a, b;
  cin >> n;
  cin >> a >> b;
  for (int i = (0); i <= (n - 1); i++) {
    if (a[i] != b[i]) {
      int u = a[i] - 'a';
      int v = b[i] - 'a';
      g[u].push_back(v);
      g[v].push_back(u);
    }
  }
  int tot = 0;
  for (int i = (0); i <= (25); i++) {
    if (!vis[i]) {
      cnt = 0;
      ++idx;
      dfs(i);
      if (cnt > 1) tot += (cnt - 1);
    }
  }
  cout << tot << "\n";
  for (int i = (1); i <= (idx); i++) {
    int s = ans[i].size();
    for (int j = (0); j <= (s - 2); j++)
      cout << (char)(ans[i][j] + 'a') << " " << (char)(ans[i][j + 1] + 'a')
           << "\n";
  }
  return 0;
}
