#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, s1;
  cin >> s >> s1;
  map<int, int> cmap;
  vector<int> chara(0);
  for (int i = 0; i < s.length(); i++) {
    if (cmap[s[i] - 'a' + 1] == 0 && cmap[s1[i] - 'a' + 1] == 0) {
      cmap[s[i] - 'a' + 1] = s1[i] - 'a' + 1;
      cmap[s1[i] - 'a' + 1] = s[i] - 'a' + 1;
      if (s[i] != s1[i]) chara.push_back(s[i] - 'a' + 1);
    } else if (cmap[s[i] - 'a' + 1] != s1[i] - 'a' + 1) {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << chara.size() << endl;
  for (int i = 0; i < chara.size(); i++) {
    cout << (char)(chara[i] + 'a' - 1) << " "
         << (char)(cmap[chara[i]] + 'a' - 1) << endl;
  }
  return 0;
}
