#include <bits/stdc++.h>
using namespace std;
char a[1111], b[1111];
int num[30];
bool check() {
  for (int i = 0; i <= 26; i++) num[i] = i;
  int l = strlen(a), ll = strlen(b);
  if (l != ll) return 0;
  for (int i = 0; i < l; i++) {
    if (a[i] != b[i]) {
      if (num[a[i] - 'a'] == a[i] - 'a') {
        num[a[i] - 'a'] = b[i] - 'a';
        num[b[i] - 'a'] = a[i] - 'a';
      } else if (num[a[i] - 'a'] != b[i] - 'a')
        return 0;
    }
  }
  for (int i = 0; i < l; i++) {
    if (num[a[i] - 'a'] != b[i] - 'a') return 0;
  }
  for (int i = 0; i <= 26; i++) num[i] = i;
  for (int i = 0; i < l; i++) {
    if (a[i] != b[i]) {
      if (num[b[i] - 'a'] == b[i] - 'a') {
        num[a[i] - 'a'] = b[i] - 'a';
        num[b[i] - 'a'] = a[i] - 'a';
      } else if (num[b[i] - 'a'] != a[i] - 'a')
        return 0;
    }
  }
  for (int i = 0; i < l; i++) {
    if (num[b[i] - 'a'] != a[i] - 'a') return 0;
  }
  return 1;
}
int main() {
  while (cin >> a >> b) {
    if (check()) {
      int flag = 0;
      for (int i = 0; i <= 25; i++) {
        if (num[i] != i) {
          flag++;
        }
      }
      printf("%d\n", flag / 2);
      for (int i = 0; i <= 25; i++) {
        if (num[i] != i) {
          printf("%c %c\n", 'a' + i, 'a' + num[i]);
          num[num[i]] = num[i];
        }
      }
    } else {
      printf("-1\n");
    }
  }
  return 0;
}
