#include <bits/stdc++.h>
using namespace std;
bool adj[27][27];
vector<vector<char> > dsu;
bool seen[27];
bool exists[27];
void dfs(vector<char>& set, char x) {
  if (seen[x - 'a']) return;
  seen[x - 'a'] = true;
  set.push_back(x);
  for (int i = 'a'; i <= 'z'; i++) {
    if (adj[x - 'a'][i - 'a']) {
      dfs(set, i);
    }
  }
  return;
}
int main() {
  int ans = 0;
  int N;
  cin >> N;
  string s1, s2;
  cin >> s1 >> s2;
  for (int i = 0; i < s1.length(); i++) {
    adj[s1[i] - 'a'][s2[i] - 'a'] = true;
    adj[s2[i] - 'a'][s1[i] - 'a'] = true;
    exists[s1[i] - 'a'] = true;
    exists[s2[i] - 'a'] = true;
  }
  for (char i = 'a'; i <= 'z'; i++) {
    if (seen[i - 'a']) continue;
    if (!exists[i - 'a']) continue;
    vector<char> set;
    dfs(set, i);
    if (set.size() != 0) {
      dsu.push_back(set);
    }
  }
  for (vector<char> v : dsu) {
    ans += (v.size() - 1);
  }
  cout << ans << '\n';
  for (vector<char> v : dsu) {
    if (v.size() > 1) {
      for (int i = 0; i < v.size() - 1; i++) {
        cout << v[i] << ' ' << v[i + 1] << '\n';
      }
    }
  }
  return 0;
}
