#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t;
  cin >> s >> t;
  int n = s.length(), flag = 0, p = 0, q = 0, h = 0;
  char d[n][2];
  for (int i = 0; i < n; i++) {
    d[i][0] = s[i];
    d[i][1] = t[i];
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i != j) {
        if ((d[i][0] == d[j][0] && d[i][1] != d[j][1]) ||
            (d[i][1] == d[j][1] && d[i][0] != d[j][0]))
          q++;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (s[i] != t[i]) flag++;
  }
  int sum[flag];
  char c[flag][2];
  for (int i = 0, j = 0; i < n; i++) {
    if (s[i] != t[i]) {
      c[j][0] = s[i];
      c[j][1] = t[i];
      j++;
    }
  }
  for (int i = 0; i < flag; i++) {
    for (int j = 0; j < flag; j++) {
      if (i != j) {
        if (c[i][1] == c[j][0]) {
          if (c[j][1] != c[i][0]) {
            p++;
          }
        }
      }
    }
    if (p > 0) break;
  }
  for (int i = 0; i < flag; i++) {
    for (int j = 0; j < flag; j++) {
      if (i != j) {
        if ((c[i][0] == c[j][0] && c[i][1] == c[j][1]) ||
            (c[i][0] == c[j][1] && c[i][1] == c[j][0])) {
          c[j][0] = '0';
          c[j][1] = '0';
        }
      }
    }
  }
  for (int i = 0; i < flag; i++) {
    if (c[i][0] != '0' && c[i][0] != '0') h++;
  }
  char res[h][2];
  for (int i = 0, j = 0; i < flag; i++) {
    if (c[i][0] != '0' && c[i][0] != '0') {
      res[j][0] = c[i][0];
      res[j][1] = c[i][1];
      j++;
    }
  }
  if (flag == 0)
    cout << "0" << endl;
  else if (p != 0 || q != 0)
    cout << "-1" << endl;
  else if (p == 0 && q == 0) {
    cout << h << endl;
    for (int i = 0; i < h; i++) {
      cout << res[i][0] << " " << res[i][1] << endl;
    }
  }
}
