#include <bits/stdc++.h>
using namespace std;
inline bool isvowel(char ch) {
  ch = tolower(ch);
  return (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u');
}
bool isprime(int n) {
  if (n < 2 || (n % 2 == 0 && n != 2)) return false;
  for (int i = 3; i * i <= n; i += 2)
    if (n % i == 0) return false;
  return true;
}
map<char, int> used;
map<char, vector<char>> graph;
vector<pair<char, char>> vec;
void dfs(char v) {
  used[v] = 1;
  for (auto to : graph[v]) {
    if (!used[to]) {
      dfs(to);
      vec.push_back(make_pair(v, to));
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, i;
  string s, t;
  set<char> st;
  cin >> n >> s >> t;
  for (i = 0; i < n; i++) {
    graph[s[i]].push_back(t[i]);
    graph[t[i]].push_back(s[i]);
    st.insert(s[i]);
    st.insert(t[i]);
  }
  for (auto it : st) {
    if (!used[it]) {
      dfs(it);
    }
  }
  cout << vec.size() << endl;
  for (auto it : vec) {
    cout << it.first << ' ' << it.second << endl;
  }
  return 0;
}
