#include <bits/stdc++.h>
const int INT_INF = 0x3f3f3f3f;
const int INT_M_INF = 0x7f7f7f7f;
const long long LL_INF = 0x3f3f3f3f3f3f3f3f;
const long long LL_M_INF = 0x7f7f7f7f7f7f7f7f;
const double pi = acos(-1.0);
using namespace std;
inline void debug(char ch) {
  for (int __ii = 0; __ii < 20; ++__ii) putchar(ch);
  printf("\n");
}
const double eps = 1e-8;
inline int dcmp(double a, double b) {
  if (fabs(a - b) < eps) return 0;
  return a < b ? -1 : 1;
}
const long long MOD = 1e9 + 7;
const int dr[] = {0, 0, -1, 1, -1, -1, 1, 1};
const int dc[] = {-1, 1, 0, 0, -1, 1, -1, 1};
const int MAXN = 1000 + 10;
const int MAXT = 10000 + 10;
char s[MAXN], t[MAXN];
int len;
char sta[100];
bool vis[100];
bool solve() {
  for (int i = 0; i < len; ++i)
    if (s[i] != t[i]) {
      if (vis[s[i] - 'a'] || vis[t[i] - 'a']) return false;
      if (sta[s[i] - 'a'] != 0) {
        if (sta[s[i] - 'a'] != t[i]) return false;
      } else if (sta[t[i] - 'a'] != 0) {
        if (sta[t[i] - 'a'] != s[i]) return false;
      } else {
        sta[s[i] - 'a'] = t[i];
        sta[t[i] - 'a'] = s[i];
      }
    } else {
      if (sta[s[i] - 'a'] != 0) return false;
      vis[s[i] - 'a'] = true;
    }
  return true;
}
vector<pair<char, char> > vec;
int main() {
  while (scanf("%s%s", s, t) == 2) {
    memset(sta, 0, sizeof(sta));
    memset(vis, false, sizeof vis);
    vec.clear();
    len = strlen(s);
    bool ans = solve();
    if (ans) {
      for (int i = 0; i < 26; ++i)
        if (sta[i] != 0) {
          vec.push_back(pair<char, char>('a' + i, sta[i]));
          sta[sta[i] - 'a'] = 0;
        }
      printf("%d\n", (int)((vec).size()));
      for (int i = 0; i < (int)((vec).size()); ++i)
        printf("%c %c\n", ((vec[i]).first), ((vec[i]).second));
    } else
      printf("-1\n");
  }
  return 0;
}
