#include <bits/stdc++.h>
using namespace std;
int hash1[30] = {0}, hash2[30] = {0}, hash3[30] = {0}, hash4[30] = {0};
bool flag[30] = {0}, flag1[30] = {0};
int main() {
  char a[1005], b[1005];
  int path[30][2], ans = 0;
  bool ju = true;
  scanf("%s%s", a, b);
  for (int i = 0; i < strlen(a); i++) {
    hash1[a[i] - 'a'] += (i - 5) * ((i) % 10 - 5);
    hash3[a[i] - 'a'] += (i - 1) * ((i) % 10 - 1);
  }
  for (int i = 0; i < strlen(b); i++) {
    hash2[b[i] - 'a'] += (i - 5) * ((i) % 10 - 5);
    hash4[b[i] - 'a'] += (i - 1) * ((i) % 10 - 1);
  }
  for (int i = 0; i < 26; i++)
    if (hash1[i] == hash2[i] && hash3[i] == hash4[i]) flag1[i] = flag[i] = true;
  for (int i = 0; i < 26; i++) {
    if (flag1[i] || flag[i]) continue;
    int j;
    for (j = 0; j < 26; j++) {
      if (flag[j]) continue;
      if (hash1[i] == hash2[j] && hash1[j] == hash2[i] &&
          hash3[i] == hash4[j] && hash4[i] == hash3[j]) {
        flag1[i] = flag[j] = true;
        break;
      }
    }
    if (flag1[i] != true) {
      ju = false;
      break;
    } else if (i != j) {
      ans++;
      path[ans][0] = i;
      path[ans][1] = j;
    }
  }
  if (ju) {
    cout << ans << endl;
    for (int i = 1; i <= ans; i++)
      printf("%c %c\n", path[i][0] + 'a', path[i][1] + 'a');
  } else
    cout << -1 << endl;
  return 0;
}
