#include <bits/stdc++.h>
using namespace std;
int main() {
  int k = 0;
  string s, t, x, y;
  cin >> s >> t;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] != t[i]) {
      for (int j = 0; j < s.length(); j++) {
        if (j == i) continue;
        if ((s[j] == t[i] && t[j] != s[i]) || (t[j] == s[i] && s[j] != t[i]) ||
            (s[j] == s[i] && t[j] != t[i]) || (t[j] == t[i] && s[j] != s[i])) {
          cout << -1;
          return 0;
        }
        if (s[j] == t[i] || s[j] == s[i]) t[j] = s[j];
      }
      x[k] = s[i];
      y[k] = t[i];
      k++;
    }
  }
  cout << k << endl;
  for (int i = 0; i < k; i++) {
    cout << x[i] << ' ' << y[i] << endl;
  }
  return 0;
}
