#include <bits/stdc++.h>
using namespace std;
int main() {
  char ch1[1005], ch2[1005];
  int visit[30], a[30];
  while (~scanf("%s", ch1)) {
    scanf("%s", ch2);
    memset(visit, 0, sizeof visit);
    int len = strlen(ch1), flag = 1, sum = 0;
    for (int i = 0; i < len; i++) {
      if (!visit[ch1[i] - 'a' + 1] && !visit[ch2[i] - 'a' + 1]) {
        visit[ch1[i] - 'a' + 1] = ch2[i] - 'a' + 1;
        visit[ch2[i] - 'a' + 1] = ch1[i] - 'a' + 1;
        if (ch1[i] != ch2[i]) a[++sum] = ch1[i] - 'a' + 1;
      } else if (ch2[i] - 'a' + 1 != visit[ch1[i] - 'a' + 1] ||
                 ch1[i] - 'a' + 1 != visit[ch2[i] - 'a' + 1])
        flag = 0;
    }
    if (!flag) {
      printf("-1\n");
      continue;
    }
    printf("%d\n", sum);
    for (int i = 1; i <= sum; i++)
      printf("%c %c\n", a[i] + 'a' - 1, visit[a[i]] + 'a' - 1);
  }
  return 0;
}
