#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 1;
int n, c;
char x, ch;
bool visited[MAX];
string s1, s2;
vector<pair<char, char> > ans;
vector<int> adj[MAX];
map<char, int> id;
map<int, char> chara;
void dfs(int u) {
  visited[u] = true;
  for (const auto &v : adj[u])
    if (!visited[v]) {
      ans.push_back({chara[v], ch});
      dfs(v);
    }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> s1 >> s2;
  for (int i = 0; i < n; i++) {
    const auto x = s1[i], y = s2[i];
    if (id.find(x) == id.end()) id[x] = c++;
    if (id.find(y) == id.end()) id[y] = c++;
    int u = id[y], v = id[x];
    chara[u] = y, chara[v] = x;
    if (x != y) {
      adj[u].push_back(v);
      adj[v].push_back(u);
    }
  }
  for (const auto &c : id)
    if (!visited[c.second]) ch = c.first, dfs(c.second);
  cout << ans.size() << "\n";
  for (const auto &p : ans) cout << p.first << " " << p.second << "\n";
  return 0;
}
