#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t;
  cin >> s >> t;
  int arr[27];
  int f = 0, c = 0;
  memset(arr, -1, sizeof(arr));
  for (int i = 0; i < s.length(); i++) {
    if (arr[s[i] - 'a'] == -1 && arr[t[i] - 'a'] == -1) {
      if (s[i] != t[i]) {
        arr[s[i] - 'a'] = t[i] - 'a';
        arr[t[i] - 'a'] = s[i] - 'a';
        c++;
      } else {
        arr[s[i] - 'a'] = -2;
        arr[t[i] - 'a'] = -2;
      }
    }
    if (arr[s[i] - 'a'] == -2 || arr[t[i] - 'a'] == -2) {
      if (s[i] != t[i]) f = 1;
    } else {
      if (arr[s[i] - 'a'] != t[i] - 'a') f = 1;
    }
  }
  if (f == 1)
    cout << "-1";
  else {
    cout << c << endl;
    for (int i = 0; i < 26; i++) {
      if (arr[i] != -1 && arr[arr[i]] != -1 && arr[i] != -2 &&
          arr[arr[i]] != -2) {
        cout << char(arr[i] + 'a') << " " << char(arr[arr[i]] + 'a') << endl;
        arr[i] = -1;
        arr[arr[i]] = -1;
      }
    }
  }
}
