#include <bits/stdc++.h>
using namespace std;
char s[1005];
char t[1005];
int f[1005];
void solve() {
  cin >> s >> t;
  int n = strlen(s);
  for (int i = 0; i < n; ++i) {
    if (f[s[i]] == 0) f[s[i]] = t[i];
    if (f[t[i]] == 0) f[t[i]] = s[i];
    if (f[s[i]] != t[i] || f[t[i]] != s[i]) {
      cout << "-1" << endl;
      return;
    }
  }
  int k = 0;
  for (int i = 'a'; i <= 'z'; ++i)
    if (f[i] && f[i] != i) ++k;
  cout << (k >> 1) << endl;
  for (int i = 'a'; i <= 'z'; ++i)
    if (f[i] && f[i] != i)
      f[f[i]] = f[i], cout << (char)i << " " << (char)f[i] << endl;
}
int main() {
  solve();
  return 0;
}
