#include <bits/stdc++.h>
using namespace std;
string s, t;
char a[1001], b[1001];
int c, c2;
bool ok;
int main() {
  ios::sync_with_stdio(0);
  cin >> s >> t;
  int z = s.size();
  for (int i = 0; i < z; i++) {
    for (int j = 0; j < i; j++) {
      if ((a[j] == s[i] && b[j] == t[i]) || (b[j] == s[i] && a[j] == t[i]))
        ok = 1;
      else if ((a[j] == s[i] && b[j] != t[i]) ||
               (a[j] != s[i] && b[j] == t[i]) ||
               (a[j] == t[i] && b[j] != s[i]) || (a[j] != t[i] && b[j] == s[i]))
        return cout << -1, 0;
    }
    if (ok) {
      ok = 0;
      continue;
    } else {
      a[c] = s[i];
      b[c] = t[i];
      c++;
      ok = 0;
      if (s[i] == t[i]) c2++;
    }
  }
  cout << c - c2;
  for (int i = 0; i < c; i++) {
    if (a[i] == b[i]) continue;
    cout << endl;
    cout << a[i] << " " << b[i];
  }
  return 0;
}
