#include <bits/stdc++.h>
using namespace std;
int main() {
  char a[1010];
  char b[1010];
  char c[1010];
  char d[1010];
  int str[30];
  int j;
  while (~scanf("%s", a)) {
    memset(str, 0, sizeof(str));
    scanf("%s", b);
    bool flag = false;
    j = 0;
    for (int i = 0; i < strlen(a); i++) {
      bool jugle = true;
      if (flag) break;
      if (a[i] != b[i]) {
        for (int k = 0; k < j; k++) {
          if ((c[k] == a[i] && d[k] == b[i]) ||
              (c[k] == b[i] && d[k] == a[i])) {
            jugle = false;
            break;
          }
          if ((c[k] == a[i] && d[k] != b[i]) ||
              (c[k] == b[i] && d[k] != a[i]) ||
              (c[k] != a[i] && d[k] == b[i]) ||
              (c[k] != b[i] && d[k] == a[i])) {
            flag = true;
            break;
          }
        }
        if (jugle) {
          c[j] = a[i];
          d[j] = b[i];
          j++;
        }
      }
    }
    for (int i = 0; i < strlen(a); i++)
      if (a[i] == b[i]) {
        for (int k = 0; k < j; k++) {
          if (a[i] == c[k] || a[i] == d[k]) {
            flag = true;
            break;
          }
        }
      }
    c[j] = 0;
    if (flag)
      cout << "-1" << endl;
    else if (strlen(c) == 0)
      cout << "0" << endl;
    else {
      cout << j << endl;
      for (int i = 0; c[i] != 0; i++) printf("%c %c\n", c[i], d[i]);
    }
    memset(a, 0, sizeof(a));
    memset(b, 0, sizeof(b));
    memset(c, 0, sizeof(c));
    memset(d, 0, sizeof(d));
  }
  return 0;
}
