#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
int d[N];
char a[N], b[N];
vector<pair<char, char> > ans;
int main() {
  scanf("%s %s", a, b);
  int n = strlen(a);
  for (int i = 0; i < 26; i++) {
    d[i] = -1;
  }
  for (int i = 0; i < n; i++) {
    int x = a[i] - 'a';
    int y = b[i] - 'a';
    if (d[x] != -1 && d[x] != y) {
      puts("-1");
      exit(0);
    }
    if (d[y] != -1 && d[y] != x) {
      puts("-1");
      exit(0);
    }
    d[x] = y;
    d[y] = x;
  }
  for (int i = 0; i < 26; i++) {
    if (d[i] != -1 && i < d[i]) {
      ans.push_back({(char)(i + 'a'), (char)(d[i] + 'a')});
    }
  }
  printf("%d\n", (int)ans.size());
  for (auto x : ans) {
    printf("%c %c\n", x.first, x.second);
  }
  return 0;
}
