#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]) {
  char s[1001], t[1001];
  char map[26], m[26];
  int i, j, k;
  int np = 0;
  int _i;
  scanf("%s %s", s, t);
  for ((i) = 0; (i) < (26); (i)++) map[i] = i, m[i] = 0;
  for (i = 0; s[i]; i++) {
    if (m[s[i] - 'a'] && map[s[i] - 'a'] != t[i] - 'a' ||
        m[t[i] - 'a'] && map[t[i] - 'a'] != s[i] - 'a')
      goto nope;
    m[s[i] - 'a'] = 1;
    map[s[i] - 'a'] = t[i] - 'a';
    m[t[i] - 'a'] = 1;
    map[t[i] - 'a'] = s[i] - 'a';
  }
  memcpy(m, map, 26);
  for ((_i) = 0; (_i) < (26); (_i)++) {
    i = _i;
    k = 0;
    while (m[i] != i) {
      j = m[i];
      m[i] = i;
      i = j;
      k++;
    }
    if (k > 2)
      goto nope;
    else if (k)
      np++;
  }
  cout << np << endl;
  memcpy(m, map, 26);
  for ((i) = 0; (i) < (26); (i)++) {
    if (m[i] != i) {
      printf("%c %c\n", i + 'a', m[i] + 'a');
      m[m[i]] = m[i];
    }
  }
  return 0;
nope:
  puts("-1");
  return 0;
}
