#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t;
  int counter = 0;
  char checker[26], bro[26];
  cin >> s >> t;
  for (int i = 0; i < 26; i++) {
    checker[i] = '0';
    bro[i] = '0';
  }
  for (int i = 0; i < s.length(); i++) {
    if (checker['z' - s[i]] == '0' && checker['z' - t[i]] == '0') {
      checker['z' - s[i]] = t[i];
      bro['z' - s[i]] = s[i];
      checker['z' - t[i]] = s[i];
      bro['z' - t[i]] = t[i];
      if (s[i] != t[i]) counter++;
    } else {
      if ((checker['z' - s[i]] != t[i] && checker['z' - s[i]] != '0') ||
          (checker['z' - t[i]] != s[i] && checker['z' - t[i]] != '0')) {
        cout << -1;
        return 0;
      }
    }
  }
  cout << counter << endl;
  for (int i = 0; i < 26; i++) {
    if (checker[i] != bro[i]) {
      cout << checker[i] << " " << bro[i] << endl;
      checker['z' - checker[i]] = bro['z' - checker[i]];
    }
  }
  return 0;
}
