#include <bits/stdc++.h>
using namespace std;
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  vector<int> arr(26, -1);
  int res = 0;
  for (int i = 0; i < s1.length(); i++) {
    int a1 = s1[i] - 97;
    int a2 = s2[i] - 97;
    if (arr[a1] == -1) {
      arr[a1] = a2;
    }
    if (arr[a2] == -1) {
      arr[a2] = a1;
    }
    if (arr[a1] != a2) {
      cout << "-1";
      return 0;
    }
    if (arr[a2] != a1) {
      cout << "-1";
      return 0;
    }
  }
  int ans = 0;
  for (int i = 0; i < 26; i++) {
    if (arr[i] != -1 && arr[i] != i) ans++;
  }
  cout << ans / 2 << endl;
  for (int i = 0; i < s1.length(); i++) {
    int index = (int)(s1[i] - 97);
    if (arr[index] != -1 && arr[index] != index) {
      char ch = arr[index] + 97;
      arr[arr[index]] = -1;
      arr[index] = -1;
      cout << s1[i] << " " << ch << endl;
    }
  }
  return 0;
}
